
// -*-c++-*-
//-------------------------------------------------------------------------
//   Copyright 2002-2023 National Technology & Engineering Solutions of
//   Sandia, LLC (NTESS).  Under the terms of Contract DE-NA0003525 with
//   NTESS, the U.S. Government retains certain rights in this software.
//
//   This file is part of the Xyce(TM) Parallel Electrical Simulator.
//
//   Xyce(TM) is free software: you can redistribute it and/or modify
//   it under the terms of the GNU General Public License as published by
//   the Free Software Foundation, either version 3 of the License, or
//   (at your option) any later version.
//
//   Xyce(TM) is distributed in the hope that it will be useful,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   GNU General Public License for more details.
//
//   You should have received a copy of the GNU General Public License
//   along with Xyce(TM).
//   If not, see <http://www.gnu.org/licenses/>.
//-------------------------------------------------------------------------

//-----------------------------------------------------------------------------
//
// Purpose        :
//
// Special Notes  : Generated from verilog file psp102.va with ADMS
//                  interface for Xyce 7.7.0
//                  DO NOT EDIT THIS FILE DIRECTLY!  It may be overwritten!
//
// Creator        : admsXml-2.3.7
//
// Creation Date  : Mon, 09 Jan 2023 12:09:04
//
//-----------------------------------------------------------------------------
#ifndef Xyce_N_DEV_ADMSPSP102VA_h
#define Xyce_N_DEV_ADMSPSP102VA_h


#include <N_DEV_Configuration.h>
#include <N_DEV_Const.h>
#include <N_DEV_DeviceBlock.h>
#include <N_DEV_DeviceInstance.h>
#include <N_DEV_DeviceModel.h>
#include <N_DEV_MOSFET1.h>


// Xyce_config.h contains a VERSION macro from autoconf, and some
// Verilog-A models like to define a variable of that name.  This can be
// a serious problem, and we don't need the VERSION macro.  Get rid of it.
// This must happen *after* all the includes of Xyce headers, each of which
// includes Xyce_config.h.  The implementation file must do this all again
// because it includes more Xyce headers *after* including this one.
#ifdef VERSION
#undef VERSION
#endif

namespace Xyce {
namespace Device {
namespace ADMSPSP102VA {

class Model;
class Instance;
class InstanceSensitivity;

#ifdef Xyce_ADMS_SENSITIVITIES
//-----------------------------------------------------------------------------
// Class         : InstanceSensitivity
//
// Purpose       : This class is a functor for sensitivity
//
// Special Notes :
// Creator       :
// Creation Date :
//-----------------------------------------------------------------------------
class InstanceSensitivity : public baseSensitivity
{
public:
InstanceSensitivity() :
baseSensitivity() {};

virtual ~InstanceSensitivity() {};

virtual void operator()(
const ParameterBase &entity,
const std::string &param,
std::vector<double> & dfdp,
std::vector<double> & dqdp,
std::vector<double> & dbdp,
std::vector<int> & Findices,
std::vector<int> & Qindices,
std::vector<int> & Bindices
) const ;
};

static InstanceSensitivity instSens;


//-----------------------------------------------------------------------------
// Class         : ModelSensitivity
//
// Purpose       : This class is a functor for sensitivity
//
// Special Notes :
// Creator       :
// Creation Date :
//-----------------------------------------------------------------------------
class ModelSensitivity : public baseSensitivity
{
public:
ModelSensitivity() :
baseSensitivity() {};

virtual ~ModelSensitivity() {};

virtual void operator()(
const ParameterBase &entity,
const std::string &param,
std::vector<double> & dfdp,
std::vector<double> & dqdp,
std::vector<double> & dbdp,
std::vector<int> & Findices,
std::vector<int> & Qindices,
std::vector<int> & Bindices
) const ;
};

static ModelSensitivity modSens;
#endif // Xyce_ADMS_SENSITIVITIES

// general purpose free functions
// thermal voltage at kelvin temperature temp)
static inline double adms_vt(const double temp) {return(CONSTKoverQ*temp);};


#ifdef Xyce_ADMS_SENSITIVITIES
//-----------------------------------------------------------------------------
// "structs" to hold instance and model param/variable copies
//-----------------------------------------------------------------------------
class instanceSensStruct
{
public:
// instance parameters
// reals
double instancePar_L;
double d_instancePar_L_dX;
bool instancePar_given_L;
double instancePar_W;
double d_instancePar_W_dX;
bool instancePar_given_W;
double instancePar_SA;
double d_instancePar_SA_dX;
bool instancePar_given_SA;
double instancePar_SB;
double d_instancePar_SB_dX;
bool instancePar_given_SB;
double instancePar_SD;
double d_instancePar_SD_dX;
bool instancePar_given_SD;
double instancePar_SCA;
double d_instancePar_SCA_dX;
bool instancePar_given_SCA;
double instancePar_SCB;
double d_instancePar_SCB_dX;
bool instancePar_given_SCB;
double instancePar_SCC;
double d_instancePar_SCC_dX;
bool instancePar_given_SCC;
double instancePar_SC;
double d_instancePar_SC_dX;
bool instancePar_given_SC;
double instancePar_DELVTO;
double d_instancePar_DELVTO_dX;
bool instancePar_given_DELVTO;
double instancePar_FACTUO;
double d_instancePar_FACTUO_dX;
bool instancePar_given_FACTUO;
double instancePar_ABSOURCE;
double d_instancePar_ABSOURCE_dX;
bool instancePar_given_ABSOURCE;
double instancePar_LSSOURCE;
double d_instancePar_LSSOURCE_dX;
bool instancePar_given_LSSOURCE;
double instancePar_LGSOURCE;
double d_instancePar_LGSOURCE_dX;
bool instancePar_given_LGSOURCE;
double instancePar_ABDRAIN;
double d_instancePar_ABDRAIN_dX;
bool instancePar_given_ABDRAIN;
double instancePar_LSDRAIN;
double d_instancePar_LSDRAIN_dX;
bool instancePar_given_LSDRAIN;
double instancePar_LGDRAIN;
double d_instancePar_LGDRAIN_dX;
bool instancePar_given_LGDRAIN;
double instancePar_AS;
double d_instancePar_AS_dX;
bool instancePar_given_AS;
double instancePar_PS;
double d_instancePar_PS_dX;
bool instancePar_given_PS;
double instancePar_AD;
double d_instancePar_AD_dX;
bool instancePar_given_AD;
double instancePar_PD;
double d_instancePar_PD_dX;
bool instancePar_given_PD;
double instancePar_MULT;
double d_instancePar_MULT_dX;
bool instancePar_given_MULT;
double instancePar_NF;
double d_instancePar_NF_dX;
bool instancePar_given_NF;
double instancePar_NGCON;
double d_instancePar_NGCON_dX;
bool instancePar_given_NGCON;
double instancePar_XGW;
double d_instancePar_XGW_dX;
bool instancePar_given_XGW;
// instance variables
// reals
double instanceVar_LE;
double d_instanceVar_LE_dX;
double instanceVar_WE;
double d_instanceVar_WE_dX;
double instanceVar_VFB_i;
double d_instanceVar_VFB_i_dX;
double instanceVar_STVFB_i;
double d_instanceVar_STVFB_i_dX;
double instanceVar_NEFF_i;
double d_instanceVar_NEFF_i_dX;
double instanceVar_VNSUB_i;
double d_instanceVar_VNSUB_i_dX;
double instanceVar_NSLP_i;
double d_instanceVar_NSLP_i_dX;
double instanceVar_DNSUB_i;
double d_instanceVar_DNSUB_i_dX;
double instanceVar_NP_i;
double d_instanceVar_NP_i_dX;
double instanceVar_CT_i;
double d_instanceVar_CT_i_dX;
double instanceVar_NOV_i;
double d_instanceVar_NOV_i_dX;
double instanceVar_NOVD_i;
double d_instanceVar_NOVD_i_dX;
double instanceVar_CF_i;
double d_instanceVar_CF_i_dX;
double instanceVar_CFB_i;
double d_instanceVar_CFB_i_dX;
double instanceVar_DPHIB_i;
double d_instanceVar_DPHIB_i_dX;
double instanceVar_BETN_i;
double d_instanceVar_BETN_i_dX;
double instanceVar_STBET_i;
double d_instanceVar_STBET_i_dX;
double instanceVar_MUE_i;
double d_instanceVar_MUE_i_dX;
double instanceVar_STMUE_i;
double d_instanceVar_STMUE_i_dX;
double instanceVar_THEMU_i;
double d_instanceVar_THEMU_i_dX;
double instanceVar_STTHEMU_i;
double d_instanceVar_STTHEMU_i_dX;
double instanceVar_CS_i;
double d_instanceVar_CS_i_dX;
double instanceVar_STCS_i;
double d_instanceVar_STCS_i_dX;
double instanceVar_XCOR_i;
double d_instanceVar_XCOR_i_dX;
double instanceVar_STXCOR_i;
double d_instanceVar_STXCOR_i_dX;
double instanceVar_FETA_i;
double d_instanceVar_FETA_i_dX;
double instanceVar_RS_i;
double d_instanceVar_RS_i_dX;
double instanceVar_THER_i;
double d_instanceVar_THER_i_dX;
double instanceVar_STRS_i;
double d_instanceVar_STRS_i_dX;
double instanceVar_RSB_i;
double d_instanceVar_RSB_i_dX;
double instanceVar_RSG_i;
double d_instanceVar_RSG_i_dX;
double instanceVar_THESAT_i;
double d_instanceVar_THESAT_i_dX;
double instanceVar_STTHESAT_i;
double d_instanceVar_STTHESAT_i_dX;
double instanceVar_THESATB_i;
double d_instanceVar_THESATB_i_dX;
double instanceVar_THESATG_i;
double d_instanceVar_THESATG_i_dX;
double instanceVar_AX_i;
double d_instanceVar_AX_i_dX;
double instanceVar_ALP_i;
double d_instanceVar_ALP_i_dX;
double instanceVar_ALP1_i;
double d_instanceVar_ALP1_i_dX;
double instanceVar_ALP2_i;
double d_instanceVar_ALP2_i_dX;
double instanceVar_VP_i;
double d_instanceVar_VP_i_dX;
double instanceVar_A1_i;
double d_instanceVar_A1_i_dX;
double instanceVar_A2_i;
double d_instanceVar_A2_i_dX;
double instanceVar_STA2_i;
double d_instanceVar_STA2_i_dX;
double instanceVar_A3_i;
double d_instanceVar_A3_i_dX;
double instanceVar_A4_i;
double d_instanceVar_A4_i_dX;
double instanceVar_GCO_i;
double d_instanceVar_GCO_i_dX;
double instanceVar_IGINV_i;
double d_instanceVar_IGINV_i_dX;
double instanceVar_IGOV_i;
double d_instanceVar_IGOV_i_dX;
double instanceVar_IGOVD_i;
double d_instanceVar_IGOVD_i_dX;
double instanceVar_STIG_i;
double d_instanceVar_STIG_i_dX;
double instanceVar_GC2_i;
double d_instanceVar_GC2_i_dX;
double instanceVar_GC3_i;
double d_instanceVar_GC3_i_dX;
double instanceVar_CHIB_i;
double d_instanceVar_CHIB_i_dX;
double instanceVar_AGIDL_i;
double d_instanceVar_AGIDL_i_dX;
double instanceVar_STBGIDL_i;
double d_instanceVar_STBGIDL_i_dX;
double instanceVar_CGIDL_i;
double d_instanceVar_CGIDL_i_dX;
double instanceVar_AGIDLD_i;
double d_instanceVar_AGIDLD_i_dX;
double instanceVar_STBGIDLD_i;
double d_instanceVar_STBGIDLD_i_dX;
double instanceVar_CGIDLD_i;
double d_instanceVar_CGIDLD_i_dX;
double instanceVar_COX_i;
double d_instanceVar_COX_i_dX;
double instanceVar_CGOV_i;
double d_instanceVar_CGOV_i_dX;
double instanceVar_CGOVD_i;
double d_instanceVar_CGOVD_i_dX;
double instanceVar_CGBOV_i;
double d_instanceVar_CGBOV_i_dX;
double instanceVar_CFR_i;
double d_instanceVar_CFR_i_dX;
double instanceVar_CFRD_i;
double d_instanceVar_CFRD_i_dX;
double instanceVar_FNT_i;
double d_instanceVar_FNT_i_dX;
double instanceVar_NFA_i;
double d_instanceVar_NFA_i_dX;
double instanceVar_NFB_i;
double d_instanceVar_NFB_i_dX;
double instanceVar_NFC_i;
double d_instanceVar_NFC_i_dX;
double instanceVar_EF_i;
double d_instanceVar_EF_i_dX;
double instanceVar_FNTEXC_i;
double d_instanceVar_FNTEXC_i_dX;
double instanceVar_MULT_i;
double d_instanceVar_MULT_i_dX;
double instanceVar_BET_i;
double d_instanceVar_BET_i_dX;
double instanceVar_kp;
double d_instanceVar_kp_dX;
double instanceVar_qq;
double d_instanceVar_qq_dX;
double instanceVar_qlim2;
double d_instanceVar_qlim2_dX;
double instanceVar_E_eff0;
double d_instanceVar_E_eff0_dX;
double instanceVar_eta_mu;
double d_instanceVar_eta_mu_dX;
double instanceVar_BCH;
double d_instanceVar_BCH_dX;
double instanceVar_BOV;
double d_instanceVar_BOV_dX;
double instanceVar_inv_CHIB;
double d_instanceVar_inv_CHIB_dX;
double instanceVar_GCQ;
double d_instanceVar_GCQ_dX;
double instanceVar_Dch;
double d_instanceVar_Dch_dX;
double instanceVar_Dov;
double d_instanceVar_Dov_dX;
double instanceVar_x1;
double instanceVar_Vdsat_lim;
double d_instanceVar_Vdsat_lim_dX;
double instanceVar_nt;
double d_instanceVar_nt_dX;
double instanceVar_Cox_over_q;
double d_instanceVar_Cox_over_q_dX;
double instanceVar_GOV_s;
double d_instanceVar_GOV_s_dX;
double instanceVar_GOV_d;
double d_instanceVar_GOV_d_dX;
double instanceVar_GOV2_s;
double d_instanceVar_GOV2_s_dX;
double instanceVar_GOV2_d;
double d_instanceVar_GOV2_d_dX;
double instanceVar_BOV_d;
double d_instanceVar_BOV_d_dX;
double instanceVar_xi_ov_s;
double d_instanceVar_xi_ov_s_dX;
double instanceVar_xi_ov_d;
double d_instanceVar_xi_ov_d_dX;
double instanceVar_inv_xi_ov_s;
double d_instanceVar_inv_xi_ov_s_dX;
double instanceVar_inv_xi_ov_d;
double d_instanceVar_inv_xi_ov_d_dX;
double instanceVar_x_mrg_ov_s;
double d_instanceVar_x_mrg_ov_s_dX;
double instanceVar_x_mrg_ov_d;
double d_instanceVar_x_mrg_ov_d_dX;
double instanceVar_inv_xg1_s;
double d_instanceVar_inv_xg1_s_dX;
double instanceVar_inv_xg1_d;
double d_instanceVar_inv_xg1_d_dX;
double instanceVar_AGIDLs;
double d_instanceVar_AGIDLs_dX;
double instanceVar_AGIDLDs;
double d_instanceVar_AGIDLDs_dX;
double instanceVar_BGIDLs;
double d_instanceVar_BGIDLs_dX;
double instanceVar_BGIDLDs;
double d_instanceVar_BGIDLDs_dX;
double instanceVar_BGIDL_T;
double d_instanceVar_BGIDL_T_dX;
double instanceVar_BGIDLD_T;
double d_instanceVar_BGIDLD_T_dX;
double instanceVar_phib;
double d_instanceVar_phib_dX;
double instanceVar_sqrt_phib;
double d_instanceVar_sqrt_phib_dX;
double instanceVar_phix;
double d_instanceVar_phix_dX;
double instanceVar_aphi;
double d_instanceVar_aphi_dX;
double instanceVar_bphi;
double d_instanceVar_bphi_dX;
double instanceVar_phix1;
double d_instanceVar_phix1_dX;
double instanceVar_G_0;
double d_instanceVar_G_0_dX;
double instanceVar_phit1;
double d_instanceVar_phit1_dX;
double instanceVar_inv_phit1;
double d_instanceVar_inv_phit1_dX;
double instanceVar_alpha_b;
double d_instanceVar_alpha_b_dX;
double instanceVar_inv_VP;
double d_instanceVar_inv_VP_dX;
double instanceVar_inv_AX;
double d_instanceVar_inv_AX_dX;
double instanceVar_Sfl_prefac;
double d_instanceVar_Sfl_prefac_dX;
double instanceVar_Sfl;
double d_instanceVar_Sfl_dX;
double instanceVar_CGeff;
double d_instanceVar_CGeff_dX;
double instanceVar_mig;
double d_instanceVar_mig_dX;
double instanceVar_c_igid;
double d_instanceVar_c_igid_dX;
double instanceVar_sqid;
double d_instanceVar_sqid_dX;
double instanceVar_fac_exc;
double d_instanceVar_fac_exc_dX;
double instanceVar_shot_iavl;
double d_instanceVar_shot_iavl_dX;
double instanceVar_shot_igcsx;
double d_instanceVar_shot_igcsx_dX;
double instanceVar_shot_igcdx;
double d_instanceVar_shot_igcdx_dX;
double instanceVar_shot_igsov;
double d_instanceVar_shot_igsov_dX;
double instanceVar_shot_igdov;
double d_instanceVar_shot_igdov_dX;
double instanceVar_RG_i;
double d_instanceVar_RG_i_dX;
double instanceVar_RBULK_i;
double d_instanceVar_RBULK_i_dX;
double instanceVar_RWELL_i;
double d_instanceVar_RWELL_i_dX;
double instanceVar_RJUNS_i;
double d_instanceVar_RJUNS_i_dX;
double instanceVar_RJUND_i;
double d_instanceVar_RJUND_i_dX;
double instanceVar_ggate;
double d_instanceVar_ggate_dX;
double instanceVar_gbulk;
double d_instanceVar_gbulk_dX;
double instanceVar_gwell;
double d_instanceVar_gwell_dX;
double instanceVar_gjund;
double d_instanceVar_gjund_dX;
double instanceVar_gjuns;
double d_instanceVar_gjuns_dX;
double instanceVar_ABSOURCE_i;
double d_instanceVar_ABSOURCE_i_dX;
double instanceVar_LSSOURCE_i;
double d_instanceVar_LSSOURCE_i_dX;
double instanceVar_LGSOURCE_i;
double d_instanceVar_LGSOURCE_i_dX;
double instanceVar_zflagbot_s;
double instanceVar_zflagsti_s;
double instanceVar_zflaggat_s;
double instanceVar_VMAX_s;
double d_instanceVar_VMAX_s_dX;
double instanceVar_exp_VMAX_over_phitd_s;
double d_instanceVar_exp_VMAX_over_phitd_s_dX;
double instanceVar_vbimin_s;
double d_instanceVar_vbimin_s_dX;
double instanceVar_vch_s;
double d_instanceVar_vch_s_dX;
double instanceVar_vfmin_s;
double d_instanceVar_vfmin_s_dX;
double instanceVar_vbbtlim_s;
double d_instanceVar_vbbtlim_s_dX;
double instanceVar_xhighf1_s;
double d_instanceVar_xhighf1_s_dX;
double instanceVar_expxhf1_s;
double d_instanceVar_expxhf1_s_dX;
double instanceVar_xhighf2_s;
double d_instanceVar_xhighf2_s_dX;
double instanceVar_expxhf2_s;
double d_instanceVar_expxhf2_s_dX;
double instanceVar_xhighr_s;
double d_instanceVar_xhighr_s_dX;
double instanceVar_expxhr_s;
double d_instanceVar_expxhr_s_dX;
double instanceVar_m0flag_s;
double instanceVar_ISATFOR1_s;
double d_instanceVar_ISATFOR1_s_dX;
double instanceVar_MFOR1_s;
double instanceVar_ISATFOR2_s;
double d_instanceVar_ISATFOR2_s_dX;
double instanceVar_MFOR2_s;
double d_instanceVar_MFOR2_s_dX;
double instanceVar_ISATREV_s;
double d_instanceVar_ISATREV_s_dX;
double instanceVar_MREV_s;
double d_instanceVar_MREV_s_dX;
double instanceVar_ABDRAIN_i;
double d_instanceVar_ABDRAIN_i_dX;
double instanceVar_LSDRAIN_i;
double d_instanceVar_LSDRAIN_i_dX;
double instanceVar_LGDRAIN_i;
double d_instanceVar_LGDRAIN_i_dX;
double instanceVar_zflagbot_d;
double instanceVar_zflagsti_d;
double instanceVar_zflaggat_d;
double instanceVar_VMAX_d;
double d_instanceVar_VMAX_d_dX;
double instanceVar_exp_VMAX_over_phitd_d;
double d_instanceVar_exp_VMAX_over_phitd_d_dX;
double instanceVar_vbimin_d;
double d_instanceVar_vbimin_d_dX;
double instanceVar_vch_d;
double d_instanceVar_vch_d_dX;
double instanceVar_vfmin_d;
double d_instanceVar_vfmin_d_dX;
double instanceVar_vbbtlim_d;
double d_instanceVar_vbbtlim_d_dX;
double instanceVar_xhighf1_d;
double d_instanceVar_xhighf1_d_dX;
double instanceVar_expxhf1_d;
double d_instanceVar_expxhf1_d_dX;
double instanceVar_xhighf2_d;
double d_instanceVar_xhighf2_d_dX;
double instanceVar_expxhf2_d;
double d_instanceVar_expxhf2_d_dX;
double instanceVar_xhighr_d;
double d_instanceVar_xhighr_d_dX;
double instanceVar_expxhr_d;
double d_instanceVar_expxhr_d_dX;
double instanceVar_m0flag_d;
double instanceVar_ISATFOR1_d;
double d_instanceVar_ISATFOR1_d_dX;
double instanceVar_MFOR1_d;
double instanceVar_ISATFOR2_d;
double d_instanceVar_ISATFOR2_d_dX;
double instanceVar_MFOR2_d;
double d_instanceVar_MFOR2_d_dX;
double instanceVar_ISATREV_d;
double d_instanceVar_ISATREV_d_dX;
double instanceVar_MREV_d;
double d_instanceVar_MREV_d_dX;
double instanceVar_jnoisex_s;
double d_instanceVar_jnoisex_s_dX;
double instanceVar_jnoisex_d;
double d_instanceVar_jnoisex_d_dX;
};

class modelSensStruct
{
public:
// model parameters
// reals
double modelPar_LEVEL;
double d_modelPar_LEVEL_dX;
bool modelPar_given_LEVEL;
double modelPar_TYPE;
double d_modelPar_TYPE_dX;
bool modelPar_given_TYPE;
double modelPar_TR;
double d_modelPar_TR_dX;
bool modelPar_given_TR;
double modelPar_SWIGATE;
double d_modelPar_SWIGATE_dX;
bool modelPar_given_SWIGATE;
double modelPar_SWIMPACT;
double d_modelPar_SWIMPACT_dX;
bool modelPar_given_SWIMPACT;
double modelPar_SWGIDL;
double d_modelPar_SWGIDL_dX;
bool modelPar_given_SWGIDL;
double modelPar_SWJUNCAP;
double d_modelPar_SWJUNCAP_dX;
bool modelPar_given_SWJUNCAP;
double modelPar_SWJUNASYM;
double d_modelPar_SWJUNASYM_dX;
bool modelPar_given_SWJUNASYM;
double modelPar_QMC;
double d_modelPar_QMC_dX;
bool modelPar_given_QMC;
double modelPar_LVARO;
double d_modelPar_LVARO_dX;
bool modelPar_given_LVARO;
double modelPar_LVARL;
double d_modelPar_LVARL_dX;
bool modelPar_given_LVARL;
double modelPar_LVARW;
double d_modelPar_LVARW_dX;
bool modelPar_given_LVARW;
double modelPar_LAP;
double d_modelPar_LAP_dX;
bool modelPar_given_LAP;
double modelPar_WVARO;
double d_modelPar_WVARO_dX;
bool modelPar_given_WVARO;
double modelPar_WVARL;
double d_modelPar_WVARL_dX;
bool modelPar_given_WVARL;
double modelPar_WVARW;
double d_modelPar_WVARW_dX;
bool modelPar_given_WVARW;
double modelPar_WOT;
double d_modelPar_WOT_dX;
bool modelPar_given_WOT;
double modelPar_DLQ;
double d_modelPar_DLQ_dX;
bool modelPar_given_DLQ;
double modelPar_DWQ;
double d_modelPar_DWQ_dX;
bool modelPar_given_DWQ;
double modelPar_VFBO;
double d_modelPar_VFBO_dX;
bool modelPar_given_VFBO;
double modelPar_VFBL;
double d_modelPar_VFBL_dX;
bool modelPar_given_VFBL;
double modelPar_VFBW;
double d_modelPar_VFBW_dX;
bool modelPar_given_VFBW;
double modelPar_VFBLW;
double d_modelPar_VFBLW_dX;
bool modelPar_given_VFBLW;
double modelPar_STVFBO;
double d_modelPar_STVFBO_dX;
bool modelPar_given_STVFBO;
double modelPar_STVFBL;
double d_modelPar_STVFBL_dX;
bool modelPar_given_STVFBL;
double modelPar_STVFBW;
double d_modelPar_STVFBW_dX;
bool modelPar_given_STVFBW;
double modelPar_STVFBLW;
double d_modelPar_STVFBLW_dX;
bool modelPar_given_STVFBLW;
double modelPar_TOXO;
double d_modelPar_TOXO_dX;
bool modelPar_given_TOXO;
double modelPar_EPSROXO;
double d_modelPar_EPSROXO_dX;
bool modelPar_given_EPSROXO;
double modelPar_NSUBO;
double d_modelPar_NSUBO_dX;
bool modelPar_given_NSUBO;
double modelPar_NSUBW;
double d_modelPar_NSUBW_dX;
bool modelPar_given_NSUBW;
double modelPar_WSEG;
double d_modelPar_WSEG_dX;
bool modelPar_given_WSEG;
double modelPar_NPCK;
double d_modelPar_NPCK_dX;
bool modelPar_given_NPCK;
double modelPar_NPCKW;
double d_modelPar_NPCKW_dX;
bool modelPar_given_NPCKW;
double modelPar_WSEGP;
double d_modelPar_WSEGP_dX;
bool modelPar_given_WSEGP;
double modelPar_LPCK;
double d_modelPar_LPCK_dX;
bool modelPar_given_LPCK;
double modelPar_LPCKW;
double d_modelPar_LPCKW_dX;
bool modelPar_given_LPCKW;
double modelPar_FOL1;
double d_modelPar_FOL1_dX;
bool modelPar_given_FOL1;
double modelPar_FOL2;
double d_modelPar_FOL2_dX;
bool modelPar_given_FOL2;
double modelPar_VNSUBO;
double d_modelPar_VNSUBO_dX;
bool modelPar_given_VNSUBO;
double modelPar_NSLPO;
double d_modelPar_NSLPO_dX;
bool modelPar_given_NSLPO;
double modelPar_DNSUBO;
double d_modelPar_DNSUBO_dX;
bool modelPar_given_DNSUBO;
double modelPar_DPHIBO;
double d_modelPar_DPHIBO_dX;
bool modelPar_given_DPHIBO;
double modelPar_DPHIBL;
double d_modelPar_DPHIBL_dX;
bool modelPar_given_DPHIBL;
double modelPar_DPHIBLEXP;
double d_modelPar_DPHIBLEXP_dX;
bool modelPar_given_DPHIBLEXP;
double modelPar_DPHIBW;
double d_modelPar_DPHIBW_dX;
bool modelPar_given_DPHIBW;
double modelPar_DPHIBLW;
double d_modelPar_DPHIBLW_dX;
bool modelPar_given_DPHIBLW;
double modelPar_NPO;
double d_modelPar_NPO_dX;
bool modelPar_given_NPO;
double modelPar_NPL;
double d_modelPar_NPL_dX;
bool modelPar_given_NPL;
double modelPar_CTO;
double d_modelPar_CTO_dX;
bool modelPar_given_CTO;
double modelPar_CTL;
double d_modelPar_CTL_dX;
bool modelPar_given_CTL;
double modelPar_CTLEXP;
double d_modelPar_CTLEXP_dX;
bool modelPar_given_CTLEXP;
double modelPar_CTW;
double d_modelPar_CTW_dX;
bool modelPar_given_CTW;
double modelPar_CTLW;
double d_modelPar_CTLW_dX;
bool modelPar_given_CTLW;
double modelPar_TOXOVO;
double d_modelPar_TOXOVO_dX;
bool modelPar_given_TOXOVO;
double modelPar_TOXOVDO;
double d_modelPar_TOXOVDO_dX;
bool modelPar_given_TOXOVDO;
double modelPar_LOV;
double d_modelPar_LOV_dX;
bool modelPar_given_LOV;
double modelPar_LOVD;
double d_modelPar_LOVD_dX;
bool modelPar_given_LOVD;
double modelPar_NOVO;
double d_modelPar_NOVO_dX;
bool modelPar_given_NOVO;
double modelPar_NOVDO;
double d_modelPar_NOVDO_dX;
bool modelPar_given_NOVDO;
double modelPar_CFL;
double d_modelPar_CFL_dX;
bool modelPar_given_CFL;
double modelPar_CFLEXP;
double d_modelPar_CFLEXP_dX;
bool modelPar_given_CFLEXP;
double modelPar_CFW;
double d_modelPar_CFW_dX;
bool modelPar_given_CFW;
double modelPar_CFBO;
double d_modelPar_CFBO_dX;
bool modelPar_given_CFBO;
double modelPar_UO;
double d_modelPar_UO_dX;
bool modelPar_given_UO;
double modelPar_FBET1;
double d_modelPar_FBET1_dX;
bool modelPar_given_FBET1;
double modelPar_FBET1W;
double d_modelPar_FBET1W_dX;
bool modelPar_given_FBET1W;
double modelPar_LP1;
double d_modelPar_LP1_dX;
bool modelPar_given_LP1;
double modelPar_LP1W;
double d_modelPar_LP1W_dX;
bool modelPar_given_LP1W;
double modelPar_FBET2;
double d_modelPar_FBET2_dX;
bool modelPar_given_FBET2;
double modelPar_LP2;
double d_modelPar_LP2_dX;
bool modelPar_given_LP2;
double modelPar_BETW1;
double d_modelPar_BETW1_dX;
bool modelPar_given_BETW1;
double modelPar_BETW2;
double d_modelPar_BETW2_dX;
bool modelPar_given_BETW2;
double modelPar_WBET;
double d_modelPar_WBET_dX;
bool modelPar_given_WBET;
double modelPar_STBETO;
double d_modelPar_STBETO_dX;
bool modelPar_given_STBETO;
double modelPar_STBETL;
double d_modelPar_STBETL_dX;
bool modelPar_given_STBETL;
double modelPar_STBETW;
double d_modelPar_STBETW_dX;
bool modelPar_given_STBETW;
double modelPar_STBETLW;
double d_modelPar_STBETLW_dX;
bool modelPar_given_STBETLW;
double modelPar_MUEO;
double d_modelPar_MUEO_dX;
bool modelPar_given_MUEO;
double modelPar_MUEW;
double d_modelPar_MUEW_dX;
bool modelPar_given_MUEW;
double modelPar_STMUEO;
double d_modelPar_STMUEO_dX;
bool modelPar_given_STMUEO;
double modelPar_THEMUO;
double d_modelPar_THEMUO_dX;
bool modelPar_given_THEMUO;
double modelPar_STTHEMUO;
double d_modelPar_STTHEMUO_dX;
bool modelPar_given_STTHEMUO;
double modelPar_CSO;
double d_modelPar_CSO_dX;
bool modelPar_given_CSO;
double modelPar_CSL;
double d_modelPar_CSL_dX;
bool modelPar_given_CSL;
double modelPar_CSLEXP;
double d_modelPar_CSLEXP_dX;
bool modelPar_given_CSLEXP;
double modelPar_CSW;
double d_modelPar_CSW_dX;
bool modelPar_given_CSW;
double modelPar_CSLW;
double d_modelPar_CSLW_dX;
bool modelPar_given_CSLW;
double modelPar_STCSO;
double d_modelPar_STCSO_dX;
bool modelPar_given_STCSO;
double modelPar_XCORO;
double d_modelPar_XCORO_dX;
bool modelPar_given_XCORO;
double modelPar_XCORL;
double d_modelPar_XCORL_dX;
bool modelPar_given_XCORL;
double modelPar_XCORW;
double d_modelPar_XCORW_dX;
bool modelPar_given_XCORW;
double modelPar_XCORLW;
double d_modelPar_XCORLW_dX;
bool modelPar_given_XCORLW;
double modelPar_STXCORO;
double d_modelPar_STXCORO_dX;
bool modelPar_given_STXCORO;
double modelPar_FETAO;
double d_modelPar_FETAO_dX;
bool modelPar_given_FETAO;
double modelPar_RSW1;
double d_modelPar_RSW1_dX;
bool modelPar_given_RSW1;
double modelPar_RSW2;
double d_modelPar_RSW2_dX;
bool modelPar_given_RSW2;
double modelPar_STRSO;
double d_modelPar_STRSO_dX;
bool modelPar_given_STRSO;
double modelPar_RSBO;
double d_modelPar_RSBO_dX;
bool modelPar_given_RSBO;
double modelPar_RSGO;
double d_modelPar_RSGO_dX;
bool modelPar_given_RSGO;
double modelPar_THESATO;
double d_modelPar_THESATO_dX;
bool modelPar_given_THESATO;
double modelPar_THESATL;
double d_modelPar_THESATL_dX;
bool modelPar_given_THESATL;
double modelPar_THESATLEXP;
double d_modelPar_THESATLEXP_dX;
bool modelPar_given_THESATLEXP;
double modelPar_THESATW;
double d_modelPar_THESATW_dX;
bool modelPar_given_THESATW;
double modelPar_THESATLW;
double d_modelPar_THESATLW_dX;
bool modelPar_given_THESATLW;
double modelPar_STTHESATO;
double d_modelPar_STTHESATO_dX;
bool modelPar_given_STTHESATO;
double modelPar_STTHESATL;
double d_modelPar_STTHESATL_dX;
bool modelPar_given_STTHESATL;
double modelPar_STTHESATW;
double d_modelPar_STTHESATW_dX;
bool modelPar_given_STTHESATW;
double modelPar_STTHESATLW;
double d_modelPar_STTHESATLW_dX;
bool modelPar_given_STTHESATLW;
double modelPar_THESATBO;
double d_modelPar_THESATBO_dX;
bool modelPar_given_THESATBO;
double modelPar_THESATGO;
double d_modelPar_THESATGO_dX;
bool modelPar_given_THESATGO;
double modelPar_AXO;
double d_modelPar_AXO_dX;
bool modelPar_given_AXO;
double modelPar_AXL;
double d_modelPar_AXL_dX;
bool modelPar_given_AXL;
double modelPar_ALPL;
double d_modelPar_ALPL_dX;
bool modelPar_given_ALPL;
double modelPar_ALPLEXP;
double d_modelPar_ALPLEXP_dX;
bool modelPar_given_ALPLEXP;
double modelPar_ALPW;
double d_modelPar_ALPW_dX;
bool modelPar_given_ALPW;
double modelPar_ALP1L1;
double d_modelPar_ALP1L1_dX;
bool modelPar_given_ALP1L1;
double modelPar_ALP1LEXP;
double d_modelPar_ALP1LEXP_dX;
bool modelPar_given_ALP1LEXP;
double modelPar_ALP1L2;
double d_modelPar_ALP1L2_dX;
bool modelPar_given_ALP1L2;
double modelPar_ALP1W;
double d_modelPar_ALP1W_dX;
bool modelPar_given_ALP1W;
double modelPar_ALP2L1;
double d_modelPar_ALP2L1_dX;
bool modelPar_given_ALP2L1;
double modelPar_ALP2LEXP;
double d_modelPar_ALP2LEXP_dX;
bool modelPar_given_ALP2LEXP;
double modelPar_ALP2L2;
double d_modelPar_ALP2L2_dX;
bool modelPar_given_ALP2L2;
double modelPar_ALP2W;
double d_modelPar_ALP2W_dX;
bool modelPar_given_ALP2W;
double modelPar_VPO;
double d_modelPar_VPO_dX;
bool modelPar_given_VPO;
double modelPar_A1O;
double d_modelPar_A1O_dX;
bool modelPar_given_A1O;
double modelPar_A1L;
double d_modelPar_A1L_dX;
bool modelPar_given_A1L;
double modelPar_A1W;
double d_modelPar_A1W_dX;
bool modelPar_given_A1W;
double modelPar_A2O;
double d_modelPar_A2O_dX;
bool modelPar_given_A2O;
double modelPar_STA2O;
double d_modelPar_STA2O_dX;
bool modelPar_given_STA2O;
double modelPar_A3O;
double d_modelPar_A3O_dX;
bool modelPar_given_A3O;
double modelPar_A3L;
double d_modelPar_A3L_dX;
bool modelPar_given_A3L;
double modelPar_A3W;
double d_modelPar_A3W_dX;
bool modelPar_given_A3W;
double modelPar_A4O;
double d_modelPar_A4O_dX;
bool modelPar_given_A4O;
double modelPar_A4L;
double d_modelPar_A4L_dX;
bool modelPar_given_A4L;
double modelPar_A4W;
double d_modelPar_A4W_dX;
bool modelPar_given_A4W;
double modelPar_GCOO;
double d_modelPar_GCOO_dX;
bool modelPar_given_GCOO;
double modelPar_IGINVLW;
double d_modelPar_IGINVLW_dX;
bool modelPar_given_IGINVLW;
double modelPar_IGOVW;
double d_modelPar_IGOVW_dX;
bool modelPar_given_IGOVW;
double modelPar_IGOVDW;
double d_modelPar_IGOVDW_dX;
bool modelPar_given_IGOVDW;
double modelPar_STIGO;
double d_modelPar_STIGO_dX;
bool modelPar_given_STIGO;
double modelPar_GC2O;
double d_modelPar_GC2O_dX;
bool modelPar_given_GC2O;
double modelPar_GC3O;
double d_modelPar_GC3O_dX;
bool modelPar_given_GC3O;
double modelPar_CHIBO;
double d_modelPar_CHIBO_dX;
bool modelPar_given_CHIBO;
double modelPar_AGIDLW;
double d_modelPar_AGIDLW_dX;
bool modelPar_given_AGIDLW;
double modelPar_AGIDLDW;
double d_modelPar_AGIDLDW_dX;
bool modelPar_given_AGIDLDW;
double modelPar_BGIDLO;
double d_modelPar_BGIDLO_dX;
bool modelPar_given_BGIDLO;
double modelPar_BGIDLDO;
double d_modelPar_BGIDLDO_dX;
bool modelPar_given_BGIDLDO;
double modelPar_STBGIDLO;
double d_modelPar_STBGIDLO_dX;
bool modelPar_given_STBGIDLO;
double modelPar_STBGIDLDO;
double d_modelPar_STBGIDLDO_dX;
bool modelPar_given_STBGIDLDO;
double modelPar_CGIDLO;
double d_modelPar_CGIDLO_dX;
bool modelPar_given_CGIDLO;
double modelPar_CGIDLDO;
double d_modelPar_CGIDLDO_dX;
bool modelPar_given_CGIDLDO;
double modelPar_CGBOVL;
double d_modelPar_CGBOVL_dX;
bool modelPar_given_CGBOVL;
double modelPar_CFRW;
double d_modelPar_CFRW_dX;
bool modelPar_given_CFRW;
double modelPar_CFRDW;
double d_modelPar_CFRDW_dX;
bool modelPar_given_CFRDW;
double modelPar_FNTO;
double d_modelPar_FNTO_dX;
bool modelPar_given_FNTO;
double modelPar_FNTEXCL;
double d_modelPar_FNTEXCL_dX;
bool modelPar_given_FNTEXCL;
double modelPar_NFALW;
double d_modelPar_NFALW_dX;
bool modelPar_given_NFALW;
double modelPar_NFBLW;
double d_modelPar_NFBLW_dX;
bool modelPar_given_NFBLW;
double modelPar_NFCLW;
double d_modelPar_NFCLW_dX;
bool modelPar_given_NFCLW;
double modelPar_EFO;
double d_modelPar_EFO_dX;
bool modelPar_given_EFO;
double modelPar_LINTNOI;
double d_modelPar_LINTNOI_dX;
bool modelPar_given_LINTNOI;
double modelPar_ALPNOI;
double d_modelPar_ALPNOI_dX;
bool modelPar_given_ALPNOI;
double modelPar_DTA;
double d_modelPar_DTA_dX;
bool modelPar_given_DTA;
double modelPar_KVTHOWEO;
double d_modelPar_KVTHOWEO_dX;
bool modelPar_given_KVTHOWEO;
double modelPar_KVTHOWEL;
double d_modelPar_KVTHOWEL_dX;
bool modelPar_given_KVTHOWEL;
double modelPar_KVTHOWEW;
double d_modelPar_KVTHOWEW_dX;
bool modelPar_given_KVTHOWEW;
double modelPar_KVTHOWELW;
double d_modelPar_KVTHOWELW_dX;
bool modelPar_given_KVTHOWELW;
double modelPar_KUOWEO;
double d_modelPar_KUOWEO_dX;
bool modelPar_given_KUOWEO;
double modelPar_KUOWEL;
double d_modelPar_KUOWEL_dX;
bool modelPar_given_KUOWEL;
double modelPar_KUOWEW;
double d_modelPar_KUOWEW_dX;
bool modelPar_given_KUOWEW;
double modelPar_KUOWELW;
double d_modelPar_KUOWELW_dX;
bool modelPar_given_KUOWELW;
double modelPar_LMIN;
double d_modelPar_LMIN_dX;
bool modelPar_given_LMIN;
double modelPar_LMAX;
double d_modelPar_LMAX_dX;
bool modelPar_given_LMAX;
double modelPar_WMIN;
double d_modelPar_WMIN_dX;
bool modelPar_given_WMIN;
double modelPar_WMAX;
double d_modelPar_WMAX_dX;
bool modelPar_given_WMAX;
double modelPar_RGO;
double d_modelPar_RGO_dX;
bool modelPar_given_RGO;
double modelPar_RBULKO;
double d_modelPar_RBULKO_dX;
bool modelPar_given_RBULKO;
double modelPar_RWELLO;
double d_modelPar_RWELLO_dX;
bool modelPar_given_RWELLO;
double modelPar_RJUNSO;
double d_modelPar_RJUNSO_dX;
bool modelPar_given_RJUNSO;
double modelPar_RJUNDO;
double d_modelPar_RJUNDO_dX;
bool modelPar_given_RJUNDO;
double modelPar_RINT;
double d_modelPar_RINT_dX;
bool modelPar_given_RINT;
double modelPar_RVPOLY;
double d_modelPar_RVPOLY_dX;
bool modelPar_given_RVPOLY;
double modelPar_RSHG;
double d_modelPar_RSHG_dX;
bool modelPar_given_RSHG;
double modelPar_DLSIL;
double d_modelPar_DLSIL_dX;
bool modelPar_given_DLSIL;
double modelPar_SAREF;
double d_modelPar_SAREF_dX;
bool modelPar_given_SAREF;
double modelPar_SBREF;
double d_modelPar_SBREF_dX;
bool modelPar_given_SBREF;
double modelPar_WLOD;
double d_modelPar_WLOD_dX;
bool modelPar_given_WLOD;
double modelPar_KUO;
double d_modelPar_KUO_dX;
bool modelPar_given_KUO;
double modelPar_KVSAT;
double d_modelPar_KVSAT_dX;
bool modelPar_given_KVSAT;
double modelPar_TKUO;
double d_modelPar_TKUO_dX;
bool modelPar_given_TKUO;
double modelPar_LKUO;
double d_modelPar_LKUO_dX;
bool modelPar_given_LKUO;
double modelPar_WKUO;
double d_modelPar_WKUO_dX;
bool modelPar_given_WKUO;
double modelPar_PKUO;
double d_modelPar_PKUO_dX;
bool modelPar_given_PKUO;
double modelPar_LLODKUO;
double d_modelPar_LLODKUO_dX;
bool modelPar_given_LLODKUO;
double modelPar_WLODKUO;
double d_modelPar_WLODKUO_dX;
bool modelPar_given_WLODKUO;
double modelPar_KVTHO;
double d_modelPar_KVTHO_dX;
bool modelPar_given_KVTHO;
double modelPar_LKVTHO;
double d_modelPar_LKVTHO_dX;
bool modelPar_given_LKVTHO;
double modelPar_WKVTHO;
double d_modelPar_WKVTHO_dX;
bool modelPar_given_WKVTHO;
double modelPar_PKVTHO;
double d_modelPar_PKVTHO_dX;
bool modelPar_given_PKVTHO;
double modelPar_LLODVTH;
double d_modelPar_LLODVTH_dX;
bool modelPar_given_LLODVTH;
double modelPar_WLODVTH;
double d_modelPar_WLODVTH_dX;
bool modelPar_given_WLODVTH;
double modelPar_STETAO;
double d_modelPar_STETAO_dX;
bool modelPar_given_STETAO;
double modelPar_LODETAO;
double d_modelPar_LODETAO_dX;
bool modelPar_given_LODETAO;
double modelPar_SCREF;
double d_modelPar_SCREF_dX;
bool modelPar_given_SCREF;
double modelPar_WEB;
double d_modelPar_WEB_dX;
bool modelPar_given_WEB;
double modelPar_WEC;
double d_modelPar_WEC_dX;
bool modelPar_given_WEC;
double modelPar_IMAX;
double d_modelPar_IMAX_dX;
bool modelPar_given_IMAX;
double modelPar_TRJ;
double d_modelPar_TRJ_dX;
bool modelPar_given_TRJ;
double modelPar_CJORBOT;
double d_modelPar_CJORBOT_dX;
bool modelPar_given_CJORBOT;
double modelPar_CJORSTI;
double d_modelPar_CJORSTI_dX;
bool modelPar_given_CJORSTI;
double modelPar_CJORGAT;
double d_modelPar_CJORGAT_dX;
bool modelPar_given_CJORGAT;
double modelPar_VBIRBOT;
double d_modelPar_VBIRBOT_dX;
bool modelPar_given_VBIRBOT;
double modelPar_VBIRSTI;
double d_modelPar_VBIRSTI_dX;
bool modelPar_given_VBIRSTI;
double modelPar_VBIRGAT;
double d_modelPar_VBIRGAT_dX;
bool modelPar_given_VBIRGAT;
double modelPar_PBOT;
double d_modelPar_PBOT_dX;
bool modelPar_given_PBOT;
double modelPar_PSTI;
double d_modelPar_PSTI_dX;
bool modelPar_given_PSTI;
double modelPar_PGAT;
double d_modelPar_PGAT_dX;
bool modelPar_given_PGAT;
double modelPar_PHIGBOT;
double d_modelPar_PHIGBOT_dX;
bool modelPar_given_PHIGBOT;
double modelPar_PHIGSTI;
double d_modelPar_PHIGSTI_dX;
bool modelPar_given_PHIGSTI;
double modelPar_PHIGGAT;
double d_modelPar_PHIGGAT_dX;
bool modelPar_given_PHIGGAT;
double modelPar_IDSATRBOT;
double d_modelPar_IDSATRBOT_dX;
bool modelPar_given_IDSATRBOT;
double modelPar_IDSATRSTI;
double d_modelPar_IDSATRSTI_dX;
bool modelPar_given_IDSATRSTI;
double modelPar_IDSATRGAT;
double d_modelPar_IDSATRGAT_dX;
bool modelPar_given_IDSATRGAT;
double modelPar_CSRHBOT;
double d_modelPar_CSRHBOT_dX;
bool modelPar_given_CSRHBOT;
double modelPar_CSRHSTI;
double d_modelPar_CSRHSTI_dX;
bool modelPar_given_CSRHSTI;
double modelPar_CSRHGAT;
double d_modelPar_CSRHGAT_dX;
bool modelPar_given_CSRHGAT;
double modelPar_XJUNSTI;
double d_modelPar_XJUNSTI_dX;
bool modelPar_given_XJUNSTI;
double modelPar_XJUNGAT;
double d_modelPar_XJUNGAT_dX;
bool modelPar_given_XJUNGAT;
double modelPar_CTATBOT;
double d_modelPar_CTATBOT_dX;
bool modelPar_given_CTATBOT;
double modelPar_CTATSTI;
double d_modelPar_CTATSTI_dX;
bool modelPar_given_CTATSTI;
double modelPar_CTATGAT;
double d_modelPar_CTATGAT_dX;
bool modelPar_given_CTATGAT;
double modelPar_MEFFTATBOT;
double d_modelPar_MEFFTATBOT_dX;
bool modelPar_given_MEFFTATBOT;
double modelPar_MEFFTATSTI;
double d_modelPar_MEFFTATSTI_dX;
bool modelPar_given_MEFFTATSTI;
double modelPar_MEFFTATGAT;
double d_modelPar_MEFFTATGAT_dX;
bool modelPar_given_MEFFTATGAT;
double modelPar_CBBTBOT;
double d_modelPar_CBBTBOT_dX;
bool modelPar_given_CBBTBOT;
double modelPar_CBBTSTI;
double d_modelPar_CBBTSTI_dX;
bool modelPar_given_CBBTSTI;
double modelPar_CBBTGAT;
double d_modelPar_CBBTGAT_dX;
bool modelPar_given_CBBTGAT;
double modelPar_FBBTRBOT;
double d_modelPar_FBBTRBOT_dX;
bool modelPar_given_FBBTRBOT;
double modelPar_FBBTRSTI;
double d_modelPar_FBBTRSTI_dX;
bool modelPar_given_FBBTRSTI;
double modelPar_FBBTRGAT;
double d_modelPar_FBBTRGAT_dX;
bool modelPar_given_FBBTRGAT;
double modelPar_STFBBTBOT;
double d_modelPar_STFBBTBOT_dX;
bool modelPar_given_STFBBTBOT;
double modelPar_STFBBTSTI;
double d_modelPar_STFBBTSTI_dX;
bool modelPar_given_STFBBTSTI;
double modelPar_STFBBTGAT;
double d_modelPar_STFBBTGAT_dX;
bool modelPar_given_STFBBTGAT;
double modelPar_VBRBOT;
double d_modelPar_VBRBOT_dX;
bool modelPar_given_VBRBOT;
double modelPar_VBRSTI;
double d_modelPar_VBRSTI_dX;
bool modelPar_given_VBRSTI;
double modelPar_VBRGAT;
double d_modelPar_VBRGAT_dX;
bool modelPar_given_VBRGAT;
double modelPar_PBRBOT;
double d_modelPar_PBRBOT_dX;
bool modelPar_given_PBRBOT;
double modelPar_PBRSTI;
double d_modelPar_PBRSTI_dX;
bool modelPar_given_PBRSTI;
double modelPar_PBRGAT;
double d_modelPar_PBRGAT_dX;
bool modelPar_given_PBRGAT;
double modelPar_CJORBOTD;
double d_modelPar_CJORBOTD_dX;
bool modelPar_given_CJORBOTD;
double modelPar_CJORSTID;
double d_modelPar_CJORSTID_dX;
bool modelPar_given_CJORSTID;
double modelPar_CJORGATD;
double d_modelPar_CJORGATD_dX;
bool modelPar_given_CJORGATD;
double modelPar_VBIRBOTD;
double d_modelPar_VBIRBOTD_dX;
bool modelPar_given_VBIRBOTD;
double modelPar_VBIRSTID;
double d_modelPar_VBIRSTID_dX;
bool modelPar_given_VBIRSTID;
double modelPar_VBIRGATD;
double d_modelPar_VBIRGATD_dX;
bool modelPar_given_VBIRGATD;
double modelPar_PBOTD;
double d_modelPar_PBOTD_dX;
bool modelPar_given_PBOTD;
double modelPar_PSTID;
double d_modelPar_PSTID_dX;
bool modelPar_given_PSTID;
double modelPar_PGATD;
double d_modelPar_PGATD_dX;
bool modelPar_given_PGATD;
double modelPar_PHIGBOTD;
double d_modelPar_PHIGBOTD_dX;
bool modelPar_given_PHIGBOTD;
double modelPar_PHIGSTID;
double d_modelPar_PHIGSTID_dX;
bool modelPar_given_PHIGSTID;
double modelPar_PHIGGATD;
double d_modelPar_PHIGGATD_dX;
bool modelPar_given_PHIGGATD;
double modelPar_IDSATRBOTD;
double d_modelPar_IDSATRBOTD_dX;
bool modelPar_given_IDSATRBOTD;
double modelPar_IDSATRSTID;
double d_modelPar_IDSATRSTID_dX;
bool modelPar_given_IDSATRSTID;
double modelPar_IDSATRGATD;
double d_modelPar_IDSATRGATD_dX;
bool modelPar_given_IDSATRGATD;
double modelPar_CSRHBOTD;
double d_modelPar_CSRHBOTD_dX;
bool modelPar_given_CSRHBOTD;
double modelPar_CSRHSTID;
double d_modelPar_CSRHSTID_dX;
bool modelPar_given_CSRHSTID;
double modelPar_CSRHGATD;
double d_modelPar_CSRHGATD_dX;
bool modelPar_given_CSRHGATD;
double modelPar_XJUNSTID;
double d_modelPar_XJUNSTID_dX;
bool modelPar_given_XJUNSTID;
double modelPar_XJUNGATD;
double d_modelPar_XJUNGATD_dX;
bool modelPar_given_XJUNGATD;
double modelPar_CTATBOTD;
double d_modelPar_CTATBOTD_dX;
bool modelPar_given_CTATBOTD;
double modelPar_CTATSTID;
double d_modelPar_CTATSTID_dX;
bool modelPar_given_CTATSTID;
double modelPar_CTATGATD;
double d_modelPar_CTATGATD_dX;
bool modelPar_given_CTATGATD;
double modelPar_MEFFTATBOTD;
double d_modelPar_MEFFTATBOTD_dX;
bool modelPar_given_MEFFTATBOTD;
double modelPar_MEFFTATSTID;
double d_modelPar_MEFFTATSTID_dX;
bool modelPar_given_MEFFTATSTID;
double modelPar_MEFFTATGATD;
double d_modelPar_MEFFTATGATD_dX;
bool modelPar_given_MEFFTATGATD;
double modelPar_CBBTBOTD;
double d_modelPar_CBBTBOTD_dX;
bool modelPar_given_CBBTBOTD;
double modelPar_CBBTSTID;
double d_modelPar_CBBTSTID_dX;
bool modelPar_given_CBBTSTID;
double modelPar_CBBTGATD;
double d_modelPar_CBBTGATD_dX;
bool modelPar_given_CBBTGATD;
double modelPar_FBBTRBOTD;
double d_modelPar_FBBTRBOTD_dX;
bool modelPar_given_FBBTRBOTD;
double modelPar_FBBTRSTID;
double d_modelPar_FBBTRSTID_dX;
bool modelPar_given_FBBTRSTID;
double modelPar_FBBTRGATD;
double d_modelPar_FBBTRGATD_dX;
bool modelPar_given_FBBTRGATD;
double modelPar_STFBBTBOTD;
double d_modelPar_STFBBTBOTD_dX;
bool modelPar_given_STFBBTBOTD;
double modelPar_STFBBTSTID;
double d_modelPar_STFBBTSTID_dX;
bool modelPar_given_STFBBTSTID;
double modelPar_STFBBTGATD;
double d_modelPar_STFBBTGATD_dX;
bool modelPar_given_STFBBTGATD;
double modelPar_VBRBOTD;
double d_modelPar_VBRBOTD_dX;
bool modelPar_given_VBRBOTD;
double modelPar_VBRSTID;
double d_modelPar_VBRSTID_dX;
bool modelPar_given_VBRSTID;
double modelPar_VBRGATD;
double d_modelPar_VBRGATD_dX;
bool modelPar_given_VBRGATD;
double modelPar_PBRBOTD;
double d_modelPar_PBRBOTD_dX;
bool modelPar_given_PBRBOTD;
double modelPar_PBRSTID;
double d_modelPar_PBRSTID_dX;
bool modelPar_given_PBRSTID;
double modelPar_PBRGATD;
double d_modelPar_PBRGATD_dX;
bool modelPar_given_PBRGATD;
double modelPar_SWJUNEXP;
double d_modelPar_SWJUNEXP_dX;
bool modelPar_given_SWJUNEXP;
double modelPar_VJUNREF;
double d_modelPar_VJUNREF_dX;
bool modelPar_given_VJUNREF;
double modelPar_FJUNQ;
double d_modelPar_FJUNQ_dX;
bool modelPar_given_FJUNQ;
double modelPar_VJUNREFD;
double d_modelPar_VJUNREFD_dX;
bool modelPar_given_VJUNREFD;
double modelPar_FJUNQD;
double d_modelPar_FJUNQD_dX;
bool modelPar_given_FJUNQD;
// model variables
// reals
double modelVar_NSUBO_i;
double d_modelVar_NSUBO_i_dX;double modelVar_WSEG_i;
double d_modelVar_WSEG_i_dX;double modelVar_NPCK_i;
double d_modelVar_NPCK_i_dX;double modelVar_WSEGP_i;
double d_modelVar_WSEGP_i_dX;double modelVar_LPCK_i;
double d_modelVar_LPCK_i_dX;double modelVar_LOV_i;
double d_modelVar_LOV_i_dX;double modelVar_LOVD_i;
double d_modelVar_LOVD_i_dX;double modelVar_LP1_i;
double d_modelVar_LP1_i_dX;double modelVar_LP2_i;
double d_modelVar_LP2_i_dX;double modelVar_WBET_i;
double d_modelVar_WBET_i_dX;double modelVar_AXL_i;
double d_modelVar_AXL_i_dX;double modelVar_ALP1L2_i;
double d_modelVar_ALP1L2_i_dX;double modelVar_ALP2L2_i;
double d_modelVar_ALP2L2_i_dX;double modelVar_RINT_i;
double d_modelVar_RINT_i_dX;double modelVar_RVPOLY_i;
double d_modelVar_RVPOLY_i_dX;double modelVar_SAREF_i;
double d_modelVar_SAREF_i_dX;double modelVar_SBREF_i;
double d_modelVar_SBREF_i_dX;double modelVar_KVSAT_i;
double d_modelVar_KVSAT_i_dX;double modelVar_LLODKUO_i;
double d_modelVar_LLODKUO_i_dX;double modelVar_WLODKUO_i;
double d_modelVar_WLODKUO_i_dX;double modelVar_LLODVTH_i;
double d_modelVar_LLODVTH_i_dX;double modelVar_WLODVTH_i;
double d_modelVar_WLODVTH_i_dX;double modelVar_LODETAO_i;
double d_modelVar_LODETAO_i_dX;double modelVar_SCREF_i;
double d_modelVar_SCREF_i_dX;double modelVar_WEB_i;
double d_modelVar_WEB_i_dX;double modelVar_WEC_i;
double d_modelVar_WEC_i_dX;double modelVar_TOX_i;
double d_modelVar_TOX_i_dX;double modelVar_EPSROX_i;
double d_modelVar_EPSROX_i_dX;double modelVar_TOXOV_i;
double d_modelVar_TOXOV_i_dX;double modelVar_TOXOVD_i;
double d_modelVar_TOXOVD_i_dX;double modelVar_TKD;
double d_modelVar_TKD_dX;double modelVar_dT;
double d_modelVar_dT_dX;double modelVar_rT;
double d_modelVar_rT_dX;double modelVar_rTn;
double d_modelVar_rTn_dX;double modelVar_EPSSI;
double modelVar_phit;
double d_modelVar_phit_dX;double modelVar_inv_phit;
double d_modelVar_inv_phit_dX;double modelVar_Eg;
double d_modelVar_Eg_dX;double modelVar_phibFac;
double d_modelVar_phibFac_dX;double modelVar_nt0;
double d_modelVar_nt0_dX;double modelVar_IMAX_i;
double d_modelVar_IMAX_i_dX;double modelVar_VBIRBOT_i;
double d_modelVar_VBIRBOT_i_dX;double modelVar_VBIRSTI_i;
double d_modelVar_VBIRSTI_i_dX;double modelVar_VBIRGAT_i;
double d_modelVar_VBIRGAT_i_dX;double modelVar_PBOT_i;
double d_modelVar_PBOT_i_dX;double modelVar_PSTI_i;
double d_modelVar_PSTI_i_dX;double modelVar_PGAT_i;
double d_modelVar_PGAT_i_dX;double modelVar_CSRHBOT_i;
double d_modelVar_CSRHBOT_i_dX;double modelVar_CSRHSTI_i;
double d_modelVar_CSRHSTI_i_dX;double modelVar_CSRHGAT_i;
double d_modelVar_CSRHGAT_i_dX;double modelVar_CTATBOT_i;
double d_modelVar_CTATBOT_i_dX;double modelVar_CTATSTI_i;
double d_modelVar_CTATSTI_i_dX;double modelVar_CTATGAT_i;
double d_modelVar_CTATGAT_i_dX;double modelVar_CBBTBOT_i;
double d_modelVar_CBBTBOT_i_dX;double modelVar_CBBTSTI_i;
double d_modelVar_CBBTSTI_i_dX;double modelVar_CBBTGAT_i;
double d_modelVar_CBBTGAT_i_dX;double modelVar_VBRBOT_i;
double d_modelVar_VBRBOT_i_dX;double modelVar_VBRSTI_i;
double d_modelVar_VBRSTI_i_dX;double modelVar_VBRGAT_i;
double d_modelVar_VBRGAT_i_dX;double modelVar_PBRBOT_i;
double d_modelVar_PBRBOT_i_dX;double modelVar_PBRSTI_i;
double d_modelVar_PBRSTI_i_dX;double modelVar_PBRGAT_i;
double d_modelVar_PBRGAT_i_dX;double modelVar_SWJUNEXP_i;
double modelVar_VJUNREF_i;
double d_modelVar_VJUNREF_i_dX;double modelVar_FJUNQ_i;
double d_modelVar_FJUNQ_i_dX;double modelVar_phitr;
double d_modelVar_phitr_dX;double modelVar_phitd;
double d_modelVar_phitd_dX;double modelVar_phitdinv;
double d_modelVar_phitdinv_dX;double modelVar_perfc;
double modelVar_berfc;
double modelVar_cerfc;
double modelVar_ftdbot;
double d_modelVar_ftdbot_dX;double modelVar_ftdsti;
double d_modelVar_ftdsti_dX;double modelVar_ftdgat;
double d_modelVar_ftdgat_dX;double modelVar_idsatbot;
double d_modelVar_idsatbot_dX;double modelVar_idsatsti;
double d_modelVar_idsatsti_dX;double modelVar_idsatgat;
double d_modelVar_idsatgat_dX;double modelVar_vbibot;
double d_modelVar_vbibot_dX;double modelVar_vbisti;
double d_modelVar_vbisti_dX;double modelVar_vbigat;
double d_modelVar_vbigat_dX;double modelVar_vbiinvbot;
double d_modelVar_vbiinvbot_dX;double modelVar_vbiinvsti;
double d_modelVar_vbiinvsti_dX;double modelVar_vbiinvgat;
double d_modelVar_vbiinvgat_dX;double modelVar_one_minus_PBOT;
double d_modelVar_one_minus_PBOT_dX;double modelVar_one_minus_PSTI;
double d_modelVar_one_minus_PSTI_dX;double modelVar_one_minus_PGAT;
double d_modelVar_one_minus_PGAT_dX;double modelVar_one_over_one_minus_PBOT;
double d_modelVar_one_over_one_minus_PBOT_dX;double modelVar_one_over_one_minus_PSTI;
double d_modelVar_one_over_one_minus_PSTI_dX;double modelVar_one_over_one_minus_PGAT;
double d_modelVar_one_over_one_minus_PGAT_dX;double modelVar_cjobot;
double d_modelVar_cjobot_dX;double modelVar_cjosti;
double d_modelVar_cjosti_dX;double modelVar_cjogat;
double d_modelVar_cjogat_dX;double modelVar_qprefbot;
double d_modelVar_qprefbot_dX;double modelVar_qprefsti;
double d_modelVar_qprefsti_dX;double modelVar_qprefgat;
double d_modelVar_qprefgat_dX;double modelVar_qpref2bot;
double d_modelVar_qpref2bot_dX;double modelVar_qpref2sti;
double d_modelVar_qpref2sti_dX;double modelVar_qpref2gat;
double d_modelVar_qpref2gat_dX;double modelVar_wdepnulrbot;
double d_modelVar_wdepnulrbot_dX;double modelVar_wdepnulrsti;
double d_modelVar_wdepnulrsti_dX;double modelVar_wdepnulrgat;
double d_modelVar_wdepnulrgat_dX;double modelVar_wdepnulrinvbot;
double d_modelVar_wdepnulrinvbot_dX;double modelVar_wdepnulrinvsti;
double d_modelVar_wdepnulrinvsti_dX;double modelVar_wdepnulrinvgat;
double d_modelVar_wdepnulrinvgat_dX;double modelVar_VBIRBOTinv;
double d_modelVar_VBIRBOTinv_dX;double modelVar_VBIRSTIinv;
double d_modelVar_VBIRSTIinv_dX;double modelVar_VBIRGATinv;
double d_modelVar_VBIRGATinv_dX;double modelVar_atatbot;
double d_modelVar_atatbot_dX;double modelVar_atatsti;
double d_modelVar_atatsti_dX;double modelVar_atatgat;
double d_modelVar_atatgat_dX;double modelVar_btatpartbot;
double d_modelVar_btatpartbot_dX;double modelVar_btatpartsti;
double d_modelVar_btatpartsti_dX;double modelVar_btatpartgat;
double d_modelVar_btatpartgat_dX;double modelVar_fbbtbot;
double d_modelVar_fbbtbot_dX;double modelVar_fbbtsti;
double d_modelVar_fbbtsti_dX;double modelVar_fbbtgat;
double d_modelVar_fbbtgat_dX;double modelVar_fstopbot;
double d_modelVar_fstopbot_dX;double modelVar_fstopsti;
double d_modelVar_fstopsti_dX;double modelVar_fstopgat;
double d_modelVar_fstopgat_dX;double modelVar_VBRinvbot;
double d_modelVar_VBRinvbot_dX;double modelVar_VBRinvsti;
double d_modelVar_VBRinvsti_dX;double modelVar_VBRinvgat;
double d_modelVar_VBRinvgat_dX;double modelVar_slopebot;
double d_modelVar_slopebot_dX;double modelVar_slopesti;
double d_modelVar_slopesti_dX;double modelVar_slopegat;
double d_modelVar_slopegat_dX;double modelVar_VBIRBOTD_i;
double d_modelVar_VBIRBOTD_i_dX;double modelVar_VBIRSTID_i;
double d_modelVar_VBIRSTID_i_dX;double modelVar_VBIRGATD_i;
double d_modelVar_VBIRGATD_i_dX;double modelVar_PBOTD_i;
double d_modelVar_PBOTD_i_dX;double modelVar_PSTID_i;
double d_modelVar_PSTID_i_dX;double modelVar_PGATD_i;
double d_modelVar_PGATD_i_dX;double modelVar_CSRHBOTD_i;
double d_modelVar_CSRHBOTD_i_dX;double modelVar_CSRHSTID_i;
double d_modelVar_CSRHSTID_i_dX;double modelVar_CSRHGATD_i;
double d_modelVar_CSRHGATD_i_dX;double modelVar_CTATBOTD_i;
double d_modelVar_CTATBOTD_i_dX;double modelVar_CTATSTID_i;
double d_modelVar_CTATSTID_i_dX;double modelVar_CTATGATD_i;
double d_modelVar_CTATGATD_i_dX;double modelVar_CBBTBOTD_i;
double d_modelVar_CBBTBOTD_i_dX;double modelVar_CBBTSTID_i;
double d_modelVar_CBBTSTID_i_dX;double modelVar_CBBTGATD_i;
double d_modelVar_CBBTGATD_i_dX;double modelVar_VBRBOTD_i;
double d_modelVar_VBRBOTD_i_dX;double modelVar_VBRSTID_i;
double d_modelVar_VBRSTID_i_dX;double modelVar_VBRGATD_i;
double d_modelVar_VBRGATD_i_dX;double modelVar_PBRBOTD_i;
double d_modelVar_PBRBOTD_i_dX;double modelVar_PBRSTID_i;
double d_modelVar_PBRSTID_i_dX;double modelVar_PBRGATD_i;
double d_modelVar_PBRGATD_i_dX;double modelVar_VJUNREFD_i;
double d_modelVar_VJUNREFD_i_dX;double modelVar_FJUNQD_i;
double d_modelVar_FJUNQD_i_dX;double modelVar_ftdbot_d;
double d_modelVar_ftdbot_d_dX;double modelVar_ftdsti_d;
double d_modelVar_ftdsti_d_dX;double modelVar_ftdgat_d;
double d_modelVar_ftdgat_d_dX;double modelVar_idsatbot_d;
double d_modelVar_idsatbot_d_dX;double modelVar_idsatsti_d;
double d_modelVar_idsatsti_d_dX;double modelVar_idsatgat_d;
double d_modelVar_idsatgat_d_dX;double modelVar_vbibot_d;
double d_modelVar_vbibot_d_dX;double modelVar_vbisti_d;
double d_modelVar_vbisti_d_dX;double modelVar_vbigat_d;
double d_modelVar_vbigat_d_dX;double modelVar_vbiinvbot_d;
double d_modelVar_vbiinvbot_d_dX;double modelVar_vbiinvsti_d;
double d_modelVar_vbiinvsti_d_dX;double modelVar_vbiinvgat_d;
double d_modelVar_vbiinvgat_d_dX;double modelVar_one_minus_PBOT_d;
double d_modelVar_one_minus_PBOT_d_dX;double modelVar_one_minus_PSTI_d;
double d_modelVar_one_minus_PSTI_d_dX;double modelVar_one_minus_PGAT_d;
double d_modelVar_one_minus_PGAT_d_dX;double modelVar_one_over_one_minus_PBOT_d;
double d_modelVar_one_over_one_minus_PBOT_d_dX;double modelVar_one_over_one_minus_PSTI_d;
double d_modelVar_one_over_one_minus_PSTI_d_dX;double modelVar_one_over_one_minus_PGAT_d;
double d_modelVar_one_over_one_minus_PGAT_d_dX;double modelVar_cjobot_d;
double d_modelVar_cjobot_d_dX;double modelVar_cjosti_d;
double d_modelVar_cjosti_d_dX;double modelVar_cjogat_d;
double d_modelVar_cjogat_d_dX;double modelVar_qprefbot_d;
double d_modelVar_qprefbot_d_dX;double modelVar_qprefsti_d;
double d_modelVar_qprefsti_d_dX;double modelVar_qprefgat_d;
double d_modelVar_qprefgat_d_dX;double modelVar_qpref2bot_d;
double d_modelVar_qpref2bot_d_dX;double modelVar_qpref2sti_d;
double d_modelVar_qpref2sti_d_dX;double modelVar_qpref2gat_d;
double d_modelVar_qpref2gat_d_dX;double modelVar_wdepnulrbot_d;
double d_modelVar_wdepnulrbot_d_dX;double modelVar_wdepnulrsti_d;
double d_modelVar_wdepnulrsti_d_dX;double modelVar_wdepnulrgat_d;
double d_modelVar_wdepnulrgat_d_dX;double modelVar_wdepnulrinvbot_d;
double d_modelVar_wdepnulrinvbot_d_dX;double modelVar_wdepnulrinvsti_d;
double d_modelVar_wdepnulrinvsti_d_dX;double modelVar_wdepnulrinvgat_d;
double d_modelVar_wdepnulrinvgat_d_dX;double modelVar_VBIRBOTinv_d;
double d_modelVar_VBIRBOTinv_d_dX;double modelVar_VBIRSTIinv_d;
double d_modelVar_VBIRSTIinv_d_dX;double modelVar_VBIRGATinv_d;
double d_modelVar_VBIRGATinv_d_dX;double modelVar_atatbot_d;
double d_modelVar_atatbot_d_dX;double modelVar_atatsti_d;
double d_modelVar_atatsti_d_dX;double modelVar_atatgat_d;
double d_modelVar_atatgat_d_dX;double modelVar_btatpartbot_d;
double d_modelVar_btatpartbot_d_dX;double modelVar_btatpartsti_d;
double d_modelVar_btatpartsti_d_dX;double modelVar_btatpartgat_d;
double d_modelVar_btatpartgat_d_dX;double modelVar_fbbtbot_d;
double d_modelVar_fbbtbot_d_dX;double modelVar_fbbtsti_d;
double d_modelVar_fbbtsti_d_dX;double modelVar_fbbtgat_d;
double d_modelVar_fbbtgat_d_dX;double modelVar_fstopbot_d;
double d_modelVar_fstopbot_d_dX;double modelVar_fstopsti_d;
double d_modelVar_fstopsti_d_dX;double modelVar_fstopgat_d;
double d_modelVar_fstopgat_d_dX;double modelVar_VBRinvbot_d;
double d_modelVar_VBRinvbot_d_dX;double modelVar_VBRinvsti_d;
double d_modelVar_VBRinvsti_d_dX;double modelVar_VBRinvgat_d;
double d_modelVar_VBRinvgat_d_dX;double modelVar_slopebot_d;
double d_modelVar_slopebot_d_dX;double modelVar_slopesti_d;
double d_modelVar_slopesti_d_dX;double modelVar_slopegat_d;
double d_modelVar_slopegat_d_dX;// non-reals
int modelVar_CHNL_TYPE;};



//-----------------------------------------------------------------------------
// Free functions used by sensitivity
//
//-----------------------------------------------------------------------------
void evaluateModelEquations(
std::vector <double> & probeVars,
// probe constants
const int admsProbeID_V_D_GND,
const int admsProbeID_V_BS_GND,
const int admsProbeID_V_BD_GND,
const int admsProbeID_V_S_GND,
const int admsProbeID_V_BP_GND,
const int admsProbeID_V_GP_GND,
const int admsProbeID_V_NOI_GND,
const int admsProbeID_V_NOI2_GND,
const int admsProbeID_V_D_BD,
const int admsProbeID_V_S_BS,
const int admsProbeID_V_S_BP,
const int admsProbeID_V_D_S,
const int admsProbeID_V_GP_S,
const int admsProbeID_V_B_BI,
const int admsProbeID_V_BP_BI,
const int admsProbeID_V_BD_BI,
const int admsProbeID_V_BS_BI,
const int admsProbeID_V_G_GP,
// node constants
const int admsNodeID_D,
const int admsNodeID_G,
const int admsNodeID_S,
const int admsNodeID_B,
const int admsNodeID_NOI,
const int admsNodeID_NOI2,
const int admsNodeID_GP,
const int admsNodeID_BP,
const int admsNodeID_BI,
const int admsNodeID_BS,
const int admsNodeID_BD,
instanceSensStruct & instanceStruct,
modelSensStruct & modelStruct,
// basic variables
 double admsTemperature, double adms_vt_nom, double ADMSgmin_arg, std::vector <double> & d_staticContributions_dX, std::vector <double> & d_dynamicContributions_dX, const Instance & theInstance);

void evaluateInitialInstance(
instanceSensStruct & instanceStruct,
modelSensStruct & modelStruct,
 double admsTemperature,double adms_vt_nom, double ADMSgmin_arg, const Instance & theInstance);

void evaluateInitialModel(
modelSensStruct & modelStruct,
 double admsTemperature, double ADMSgmin_arg, const Instance & theInstance);

#endif // Xyce_ADMS_SENSITIVITIES


// Limited exponential --- NOT what verilog LRM says, but what qucs,
// ng-spice, and zspice do.

template <typename T>
T limexp(const T &x)
{
  if ((x) < 80.0)
  return (exp(x));
  else
  return (exp(80.0)*(x-79.0));
}


struct Traits: public DeviceTraits<Model, Instance, MOSFET1::Traits>
{
  static const char *name() {return "PSP102VA legacy MOSFET 102.5";}
  static const char *deviceTypeName() {return "M level 102";}

  static int numNodes() {return 4;}


  static bool modelRequired() {return true;}
  static bool isLinearDevice() {return false;}

  static Device *factory(const Configuration &configuration, const FactoryBlock &factory_block);
  static void loadModelParameters(ParametricData<Model> &model_parameters);
  static void loadInstanceParameters(ParametricData<Instance> &instance_parameters);
};

//-----------------------------------------------------------------------------
// Class         : Instance

//
// Purpose       : This class represents a single instance  of the
//                 device.  It mainly contains indices and pointers into
//                 the matrix equation (see the resistor instance class for
//                 more details).
//
// Special Notes :
// Creator       :
// Creation Date :
//-----------------------------------------------------------------------------
class Instance : public DeviceInstance
{
  friend class ParametricData<Instance>;
  friend class Model;
#ifdef Xyce_ADMS_SENSITIVITIES
  friend class InstanceSensitivity;
  friend class ModelSensitivity;
#endif // Xyce_ADMS_SENSITIVITIES
  friend struct Traits;

  public:
    Instance(
      const Configuration &       configuration,
      const InstanceBlock &       instance_block,
      Model &                     model,
      const FactoryBlock &        factory_block);

    ~Instance();

private:
    Instance(const Instance &);
    Instance &operator=(const Instance &);

public:
    void registerLIDs( const LocalIdVector & intLIDVecRef,
                       const LocalIdVector & extLIDVecRef );
    void registerStoreLIDs( const LocalIdVector & stoLIDVecRef );
    void setupPointers();

    void loadNodeSymbols(Util::SymbolTable &symbol_table) const;

    const JacobianStamp & jacobianStamp() const;
    void registerJacLIDs( const JacobianStamp & jacLIDVec );

    void registerBranchDataLIDs(const std::vector<int> & branchLIDVecRef);

    bool processParams();
    bool updateTemperature ( const double & temp = -999.0 );
    bool updateIntermediateVars ();
    bool updatePrimaryState ();
    bool updateSecondaryState ();

    // load functions, residual:
    bool loadDAEQVector ();
    bool loadDAEFVector ();

    // load functions, Jacobian:
    bool loadDAEdQdx ();
    bool loadDAEdFdx ();

      void collapseNodes();
      int getNumNoiseSources () const;  // 12
      void setupNoiseSources (Xyce::Analysis::NoiseData & noiseData);
      void getNoiseSources (Xyce::Analysis::NoiseData & noiseData);

  private:

  public:
    // iterator reference to the PSP102VA model which owns this instance.
    // Getters and setters
    Model &getModel()
    {
      return model_;
    }

  private:

    Model & model_;   //< Owning Model
    // Begin verilog Instance Variables
    //   Instance Parameters
    double L;
    double W;
    double SA;
    double SB;
    double SD;
    double SCA;
    double SCB;
    double SCC;
    double SC;
    double DELVTO;
    double FACTUO;
    double ABSOURCE;
    double LSSOURCE;
    double LGSOURCE;
    double ABDRAIN;
    double LSDRAIN;
    double LGDRAIN;
    double AS;
    double PS;
    double AD;
    double PD;
    double MULT;
    double NF;
    double NGCON;
    double XGW;
    //  Variables of global_instance scope
    double LE;
    double WE;
    double VFB_i;
    double STVFB_i;
    double NEFF_i;
    double VNSUB_i;
    double NSLP_i;
    double DNSUB_i;
    double NP_i;
    double CT_i;
    double NOV_i;
    double NOVD_i;
    double CF_i;
    double CFB_i;
    double DPHIB_i;
    double BETN_i;
    double STBET_i;
    double MUE_i;
    double STMUE_i;
    double THEMU_i;
    double STTHEMU_i;
    double CS_i;
    double STCS_i;
    double XCOR_i;
    double STXCOR_i;
    double FETA_i;
    double RS_i;
    double THER_i;
    double STRS_i;
    double RSB_i;
    double RSG_i;
    double THESAT_i;
    double STTHESAT_i;
    double THESATB_i;
    double THESATG_i;
    double AX_i;
    double ALP_i;
    double ALP1_i;
    double ALP2_i;
    double VP_i;
    double A1_i;
    double A2_i;
    double STA2_i;
    double A3_i;
    double A4_i;
    double GCO_i;
    double IGINV_i;
    double IGOV_i;
    double IGOVD_i;
    double STIG_i;
    double GC2_i;
    double GC3_i;
    double CHIB_i;
    double AGIDL_i;
    double STBGIDL_i;
    double CGIDL_i;
    double AGIDLD_i;
    double STBGIDLD_i;
    double CGIDLD_i;
    double COX_i;
    double CGOV_i;
    double CGOVD_i;
    double CGBOV_i;
    double CFR_i;
    double CFRD_i;
    double FNT_i;
    double NFA_i;
    double NFB_i;
    double NFC_i;
    double EF_i;
    double FNTEXC_i;
    double MULT_i;
    double BET_i;
    double kp;
    double qq;
    double qlim2;
    double E_eff0;
    double eta_mu;
    double BCH;
    double BOV;
    double inv_CHIB;
    double GCQ;
    double Dch;
    double Dov;
    double x1;
    double Vdsat_lim;
    double nt;
    double Cox_over_q;
    double GOV_s;
    double GOV_d;
    double GOV2_s;
    double GOV2_d;
    double BOV_d;
    double xi_ov_s;
    double xi_ov_d;
    double inv_xi_ov_s;
    double inv_xi_ov_d;
    double x_mrg_ov_s;
    double x_mrg_ov_d;
    double inv_xg1_s;
    double inv_xg1_d;
    double AGIDLs;
    double AGIDLDs;
    double BGIDLs;
    double BGIDLDs;
    double BGIDL_T;
    double BGIDLD_T;
    double phib;
    double sqrt_phib;
    double phix;
    double aphi;
    double bphi;
    double phix1;
    double G_0;
    double phit1;
    double inv_phit1;
    double alpha_b;
    double inv_VP;
    double inv_AX;
    double Sfl_prefac;
    double Sfl;
    double CGeff;
     double d_CGeff_dV_D_S;
     double d_CGeff_dV_GP_S;
     double d_CGeff_dV_S_BP;
    double mig;
     double d_mig_dV_D_S;
     double d_mig_dV_GP_S;
     double d_mig_dV_S_BP;
    double c_igid;
    double sqid;
    double fac_exc;
    double shot_iavl;
    double shot_igcsx;
    double shot_igcdx;
    double shot_igsov;
    double shot_igdov;
    double RG_i;
    double RBULK_i;
    double RWELL_i;
    double RJUNS_i;
    double RJUND_i;
    double ggate;
    double gbulk;
    double gwell;
    double gjund;
    double gjuns;
    double ABSOURCE_i;
    double LSSOURCE_i;
    double LGSOURCE_i;
    double zflagbot_s;
    double zflagsti_s;
    double zflaggat_s;
    double VMAX_s;
    double exp_VMAX_over_phitd_s;
    double vbimin_s;
    double vch_s;
    double vfmin_s;
    double vbbtlim_s;
    double xhighf1_s;
    double expxhf1_s;
    double xhighf2_s;
    double expxhf2_s;
    double xhighr_s;
    double expxhr_s;
    double m0flag_s;
    double ISATFOR1_s;
    double MFOR1_s;
    double ISATFOR2_s;
    double MFOR2_s;
    double ISATREV_s;
    double MREV_s;
    double ABDRAIN_i;
    double LSDRAIN_i;
    double LGDRAIN_i;
    double zflagbot_d;
    double zflagsti_d;
    double zflaggat_d;
    double VMAX_d;
    double exp_VMAX_over_phitd_d;
    double vbimin_d;
    double vch_d;
    double vfmin_d;
    double vbbtlim_d;
    double xhighf1_d;
    double expxhf1_d;
    double xhighf2_d;
    double expxhf2_d;
    double xhighr_d;
    double expxhr_d;
    double m0flag_d;
    double ISATFOR1_d;
    double MFOR1_d;
    double ISATFOR2_d;
    double MFOR2_d;
    double ISATREV_d;
    double MREV_d;
    double jnoisex_s;
    double jnoisex_d;
    double ctype;
    double sdint;
    double ise;
    double ige;
    double ide;
    double ibe;
    double ids;
    double idb;
    double isb;
    double igs;
    double igd;
    double igb;
    double igcs;
    double igcd;
    double iavl;
    double igisl;
    double igidl;
    double ijs;
    double ijsbot;
    double ijsgat;
    double ijssti;
    double ijd;
    double ijdbot;
    double ijdgat;
    double ijdsti;
    double vds;
    double vgs;
    double vsb;
    double vto;
    double vts;
    double vth;
    double vgt;
    double vdss;
    double vsat;
    double gm;
    double gmb;
    double gds;
    double gjs;
    double gjd;
    double cdd;
    double cdg;
    double cds;
    double cdb;
    double cgd;
    double cgg;
    double cgs;
    double cgb;
    double csd;
    double csg;
    double css;
    double csb;
    double cbd;
    double cbg;
    double cbs;
    double cbb;
    double cgsol;
    double cgdol;
    double cjs;
    double cjsbot;
    double cjsgat;
    double cjssti;
    double cjd;
    double cjdbot;
    double cjdgat;
    double cjdsti;
    double weff;
    double leff;
    double u;
    double rout;
    double vearly;
    double beff;
    double fug;
    double rg;
    double sfl;
    double sqrtsff;
    double sqrtsfw;
    double sid;
    double sig;
    double cigid;
    double fknee;
    double sigs;
    double sigd;
    double siavl;
    double ssi;
    double sdi;
    double lp_vfb;
    double lp_stvfb;
    double lp_tox;
    double lp_epsrox;
    double lp_neff;
    double lp_vnsub;
    double lp_nslp;
    double lp_dnsub;
    double lp_dphib;
    double lp_np;
    double lp_ct;
    double lp_toxov;
    double lp_toxovd;
    double lp_nov;
    double lp_novd;
    double lp_cf;
    double lp_cfb;
    double lp_betn;
    double lp_stbet;
    double lp_mue;
    double lp_stmue;
    double lp_themu;
    double lp_stthemu;
    double lp_cs;
    double lp_stcs;
    double lp_xcor;
    double lp_stxcor;
    double lp_feta;
    double lp_rs;
    double lp_strs;
    double lp_rsb;
    double lp_rsg;
    double lp_thesat;
    double lp_stthesat;
    double lp_thesatb;
    double lp_thesatg;
    double lp_ax;
    double lp_alp;
    double lp_alp1;
    double lp_alp2;
    double lp_vp;
    double lp_a1;
    double lp_a2;
    double lp_sta2;
    double lp_a3;
    double lp_a4;
    double lp_gco;
    double lp_iginv;
    double lp_igov;
    double lp_igovd;
    double lp_stig;
    double lp_gc2;
    double lp_gc3;
    double lp_chib;
    double lp_agidl;
    double lp_agidld;
    double lp_bgidl;
    double lp_bgidld;
    double lp_stbgidl;
    double lp_stbgidld;
    double lp_cgidl;
    double lp_cgidld;
    double lp_cox;
    double lp_cgov;
    double lp_cgovd;
    double lp_cgbov;
    double lp_cfr;
    double lp_cfrd;
    double lp_fnt;
    double lp_fntexc;
    double lp_nfa;
    double lp_nfb;
    double lp_nfc;
    double lp_ef;
    double lp_rg;
    double lp_rbulk;
    double lp_rwell;
    double lp_rjuns;
    double lp_rjund;
    double tk;
    double cjosbot;
    double cjossti;
    double cjosgat;
    double vbisbot;
    double vbissti;
    double vbisgat;
    double idsatsbot;
    double idsatssti;
    double idsatsgat;
    double cjosbotd;
    double cjosstid;
    double cjosgatd;
    double vbisbotd;
    double vbisstid;
    double vbisgatd;
    double idsatsbotd;
    double idsatsstid;
    double idsatsgatd;
    // end verilog Instance Variables=====
    // Nodal LID Variables
    int li_D;
    int li_G;
    int li_S;
    int li_B;
    int li_NOI;
    int li_NOI2;
    int li_GP;
    int li_BP;
    int li_BI;
    int li_BS;
    int li_BD;
    // end Nodal LID Variables
    // Branch LID Variables
    // end Branch LID Variables
    // Lead (branch) LID Variables
    int li_branch_iD;
    int li_branch_iG;
    int li_branch_iS;
    int li_branch_iB;
    // end Lead (branch) LID Variables
    // Jacobian  pointers
    double * f_D_Equ_S_Node_Ptr;
    double * f_D_Equ_BP_Node_Ptr;
    double * f_BP_Equ_S_Node_Ptr;
    double * f_BP_Equ_BP_Node_Ptr;
    double * f_D_Equ_D_Node_Ptr;
    double * f_BP_Equ_D_Node_Ptr;
    double * f_D_Equ_GP_Node_Ptr;
    double * f_BP_Equ_GP_Node_Ptr;
    double * f_S_Equ_S_Node_Ptr;
    double * f_S_Equ_BP_Node_Ptr;
    double * f_S_Equ_D_Node_Ptr;
    double * f_S_Equ_GP_Node_Ptr;
    double * f_GP_Equ_S_Node_Ptr;
    double * f_GP_Equ_BP_Node_Ptr;
    double * f_GP_Equ_D_Node_Ptr;
    double * f_GP_Equ_GP_Node_Ptr;
    double * f_BS_Equ_S_Node_Ptr;
    double * f_BS_Equ_BS_Node_Ptr;
    double * f_S_Equ_BS_Node_Ptr;
    double * f_BS_Equ_D_Node_Ptr;
    double * f_BS_Equ_BD_Node_Ptr;
    double * f_S_Equ_BD_Node_Ptr;
    double * f_BD_Equ_S_Node_Ptr;
    double * f_BD_Equ_BS_Node_Ptr;
    double * f_D_Equ_BS_Node_Ptr;
    double * f_BD_Equ_D_Node_Ptr;
    double * f_BD_Equ_BD_Node_Ptr;
    double * f_D_Equ_BD_Node_Ptr;
    double * f_G_Equ_G_Node_Ptr;
    double * f_G_Equ_GP_Node_Ptr;
    double * f_GP_Equ_G_Node_Ptr;
    double * f_BP_Equ_BI_Node_Ptr;
    double * f_BI_Equ_BP_Node_Ptr;
    double * f_BI_Equ_BI_Node_Ptr;
    double * f_BS_Equ_BI_Node_Ptr;
    double * f_BI_Equ_BS_Node_Ptr;
    double * f_BD_Equ_BI_Node_Ptr;
    double * f_BI_Equ_BD_Node_Ptr;
    double * f_B_Equ_B_Node_Ptr;
    double * f_B_Equ_BI_Node_Ptr;
    double * f_BI_Equ_B_Node_Ptr;
    double * f_NOI2_Equ_NOI2_Node_Ptr;
    double * f_NOI2_Equ_S_Node_Ptr;
    double * f_NOI2_Equ_BP_Node_Ptr;
    double * f_NOI2_Equ_GP_Node_Ptr;
    double * f_NOI2_Equ_D_Node_Ptr;
    double * f_NOI_Equ_S_Node_Ptr;
    double * f_NOI_Equ_BP_Node_Ptr;
    double * f_NOI_Equ_GP_Node_Ptr;
    double * f_NOI_Equ_D_Node_Ptr;
    double * f_NOI_Equ_NOI2_Node_Ptr;
    double * f_NOI_Equ_NOI_Node_Ptr;
    double * f_D_Equ_NOI2_Node_Ptr;
    double * f_S_Equ_NOI2_Node_Ptr;
    double * f_GP_Equ_NOI_Node_Ptr;
    double * f_S_Equ_NOI_Node_Ptr;
    double * f_D_Equ_NOI_Node_Ptr;
    double * f_BS_Equ_BP_Node_Ptr;
    double * f_BS_Equ_GP_Node_Ptr;
    double * f_BD_Equ_BP_Node_Ptr;
    double * f_BD_Equ_GP_Node_Ptr;
    double * q_D_Equ_S_Node_Ptr;
    double * q_D_Equ_BP_Node_Ptr;
    double * q_BP_Equ_S_Node_Ptr;
    double * q_BP_Equ_BP_Node_Ptr;
    double * q_D_Equ_D_Node_Ptr;
    double * q_BP_Equ_D_Node_Ptr;
    double * q_D_Equ_GP_Node_Ptr;
    double * q_BP_Equ_GP_Node_Ptr;
    double * q_S_Equ_S_Node_Ptr;
    double * q_S_Equ_BP_Node_Ptr;
    double * q_S_Equ_D_Node_Ptr;
    double * q_S_Equ_GP_Node_Ptr;
    double * q_GP_Equ_S_Node_Ptr;
    double * q_GP_Equ_BP_Node_Ptr;
    double * q_GP_Equ_D_Node_Ptr;
    double * q_GP_Equ_GP_Node_Ptr;
    double * q_BS_Equ_S_Node_Ptr;
    double * q_BS_Equ_BS_Node_Ptr;
    double * q_S_Equ_BS_Node_Ptr;
    double * q_BS_Equ_D_Node_Ptr;
    double * q_BS_Equ_BD_Node_Ptr;
    double * q_S_Equ_BD_Node_Ptr;
    double * q_BD_Equ_S_Node_Ptr;
    double * q_BD_Equ_BS_Node_Ptr;
    double * q_D_Equ_BS_Node_Ptr;
    double * q_BD_Equ_D_Node_Ptr;
    double * q_BD_Equ_BD_Node_Ptr;
    double * q_D_Equ_BD_Node_Ptr;
    double * q_G_Equ_G_Node_Ptr;
    double * q_G_Equ_GP_Node_Ptr;
    double * q_GP_Equ_G_Node_Ptr;
    double * q_BP_Equ_BI_Node_Ptr;
    double * q_BI_Equ_BP_Node_Ptr;
    double * q_BI_Equ_BI_Node_Ptr;
    double * q_BS_Equ_BI_Node_Ptr;
    double * q_BI_Equ_BS_Node_Ptr;
    double * q_BD_Equ_BI_Node_Ptr;
    double * q_BI_Equ_BD_Node_Ptr;
    double * q_B_Equ_B_Node_Ptr;
    double * q_B_Equ_BI_Node_Ptr;
    double * q_BI_Equ_B_Node_Ptr;
    double * q_NOI2_Equ_NOI2_Node_Ptr;
    double * q_NOI2_Equ_S_Node_Ptr;
    double * q_NOI2_Equ_BP_Node_Ptr;
    double * q_NOI2_Equ_GP_Node_Ptr;
    double * q_NOI2_Equ_D_Node_Ptr;
    double * q_NOI_Equ_S_Node_Ptr;
    double * q_NOI_Equ_BP_Node_Ptr;
    double * q_NOI_Equ_GP_Node_Ptr;
    double * q_NOI_Equ_D_Node_Ptr;
    double * q_NOI_Equ_NOI2_Node_Ptr;
    double * q_NOI_Equ_NOI_Node_Ptr;
    double * q_D_Equ_NOI2_Node_Ptr;
    double * q_S_Equ_NOI2_Node_Ptr;
    double * q_GP_Equ_NOI_Node_Ptr;
    double * q_S_Equ_NOI_Node_Ptr;
    double * q_D_Equ_NOI_Node_Ptr;
    double * q_BS_Equ_BP_Node_Ptr;
    double * q_BS_Equ_GP_Node_Ptr;
    double * q_BD_Equ_BP_Node_Ptr;
    double * q_BD_Equ_GP_Node_Ptr;
    // Jacobian offsets
    int A_D_Equ_S_NodeOffset;
    int A_D_Equ_BP_NodeOffset;
    int A_BP_Equ_S_NodeOffset;
    int A_BP_Equ_BP_NodeOffset;
    int A_D_Equ_D_NodeOffset;
    int A_BP_Equ_D_NodeOffset;
    int A_D_Equ_GP_NodeOffset;
    int A_BP_Equ_GP_NodeOffset;
    int A_S_Equ_S_NodeOffset;
    int A_S_Equ_BP_NodeOffset;
    int A_S_Equ_D_NodeOffset;
    int A_S_Equ_GP_NodeOffset;
    int A_GP_Equ_S_NodeOffset;
    int A_GP_Equ_BP_NodeOffset;
    int A_GP_Equ_D_NodeOffset;
    int A_GP_Equ_GP_NodeOffset;
    int A_BS_Equ_S_NodeOffset;
    int A_BS_Equ_BS_NodeOffset;
    int A_S_Equ_BS_NodeOffset;
    int A_BS_Equ_D_NodeOffset;
    int A_BS_Equ_BD_NodeOffset;
    int A_S_Equ_BD_NodeOffset;
    int A_BD_Equ_S_NodeOffset;
    int A_BD_Equ_BS_NodeOffset;
    int A_D_Equ_BS_NodeOffset;
    int A_BD_Equ_D_NodeOffset;
    int A_BD_Equ_BD_NodeOffset;
    int A_D_Equ_BD_NodeOffset;
    int A_G_Equ_G_NodeOffset;
    int A_G_Equ_GP_NodeOffset;
    int A_GP_Equ_G_NodeOffset;
    int A_BP_Equ_BI_NodeOffset;
    int A_BI_Equ_BP_NodeOffset;
    int A_BI_Equ_BI_NodeOffset;
    int A_BS_Equ_BI_NodeOffset;
    int A_BI_Equ_BS_NodeOffset;
    int A_BD_Equ_BI_NodeOffset;
    int A_BI_Equ_BD_NodeOffset;
    int A_B_Equ_B_NodeOffset;
    int A_B_Equ_BI_NodeOffset;
    int A_BI_Equ_B_NodeOffset;
    int A_NOI2_Equ_NOI2_NodeOffset;
    int A_NOI2_Equ_S_NodeOffset;
    int A_NOI2_Equ_BP_NodeOffset;
    int A_NOI2_Equ_GP_NodeOffset;
    int A_NOI2_Equ_D_NodeOffset;
    int A_NOI_Equ_S_NodeOffset;
    int A_NOI_Equ_BP_NodeOffset;
    int A_NOI_Equ_GP_NodeOffset;
    int A_NOI_Equ_D_NodeOffset;
    int A_NOI_Equ_NOI2_NodeOffset;
    int A_NOI_Equ_NOI_NodeOffset;
    int A_D_Equ_NOI2_NodeOffset;
    int A_S_Equ_NOI2_NodeOffset;
    int A_GP_Equ_NOI_NodeOffset;
    int A_S_Equ_NOI_NodeOffset;
    int A_D_Equ_NOI_NodeOffset;
    int A_BS_Equ_BP_NodeOffset;
    int A_BS_Equ_GP_NodeOffset;
    int A_BD_Equ_BP_NodeOffset;
    int A_BD_Equ_GP_NodeOffset;
    // end of Jacobian and pointers
   // node numbers
    static const int admsNodeID_D = 0;
    static const int admsNodeID_G = 1;
    static const int admsNodeID_S = 2;
    static const int admsNodeID_B = 3;
    static const int admsNodeID_NOI = 0+4;
    static const int admsNodeID_NOI2 = 1+4;
    static const int admsNodeID_GP = 2+4;
    static const int admsNodeID_BP = 3+4;
    static const int admsNodeID_BI = 4+4;
    static const int admsNodeID_BS = 5+4;
    static const int admsNodeID_BD = 6+4;
    static const int admsNodeID_GND = -1;
   // end node numbers
   // Additional IDs for branch equations
   // end branch numbers
   // Probe numbers
    static const int admsProbeID_V_D_GND = 0;
    static const int admsProbeID_V_BS_GND = 1;
    static const int admsProbeID_V_BD_GND = 2;
    static const int admsProbeID_V_S_GND = 3;
    static const int admsProbeID_V_BP_GND = 4;
    static const int admsProbeID_V_GP_GND = 5;
    static const int admsProbeID_V_NOI_GND = 6;
    static const int admsProbeID_V_NOI2_GND = 7;
    static const int admsProbeID_V_D_BD = 8;
    static const int admsProbeID_V_S_BS = 9;
    static const int admsProbeID_V_S_BP = 10;
    static const int admsProbeID_V_D_S = 11;
    static const int admsProbeID_V_GP_S = 12;
    static const int admsProbeID_V_B_BI = 13;
    static const int admsProbeID_V_BP_BI = 14;
    static const int admsProbeID_V_BD_BI = 15;
    static const int admsProbeID_V_BS_BI = 16;
    static const int admsProbeID_V_G_GP = 17;
   // end probe numbers
   // Store LIDs
   // end store LIDs
   // Store LIDs for output vars
    int li_store_ctype;
    int li_store_sdint;
    int li_store_ise;
    int li_store_ige;
    int li_store_ide;
    int li_store_ibe;
    int li_store_ids;
    int li_store_idb;
    int li_store_isb;
    int li_store_igs;
    int li_store_igd;
    int li_store_igb;
    int li_store_igcs;
    int li_store_igcd;
    int li_store_iavl;
    int li_store_igisl;
    int li_store_igidl;
    int li_store_ijs;
    int li_store_ijsbot;
    int li_store_ijsgat;
    int li_store_ijssti;
    int li_store_ijd;
    int li_store_ijdbot;
    int li_store_ijdgat;
    int li_store_ijdsti;
    int li_store_vds;
    int li_store_vgs;
    int li_store_vsb;
    int li_store_vto;
    int li_store_vts;
    int li_store_vth;
    int li_store_vgt;
    int li_store_vdss;
    int li_store_vsat;
    int li_store_gm;
    int li_store_gmb;
    int li_store_gds;
    int li_store_gjs;
    int li_store_gjd;
    int li_store_cdd;
    int li_store_cdg;
    int li_store_cds;
    int li_store_cdb;
    int li_store_cgd;
    int li_store_cgg;
    int li_store_cgs;
    int li_store_cgb;
    int li_store_csd;
    int li_store_csg;
    int li_store_css;
    int li_store_csb;
    int li_store_cbd;
    int li_store_cbg;
    int li_store_cbs;
    int li_store_cbb;
    int li_store_cgsol;
    int li_store_cgdol;
    int li_store_cjs;
    int li_store_cjsbot;
    int li_store_cjsgat;
    int li_store_cjssti;
    int li_store_cjd;
    int li_store_cjdbot;
    int li_store_cjdgat;
    int li_store_cjdsti;
    int li_store_weff;
    int li_store_leff;
    int li_store_u;
    int li_store_rout;
    int li_store_vearly;
    int li_store_beff;
    int li_store_fug;
    int li_store_rg;
    int li_store_sfl;
    int li_store_sqrtsff;
    int li_store_sqrtsfw;
    int li_store_sid;
    int li_store_sig;
    int li_store_cigid;
    int li_store_fknee;
    int li_store_sigs;
    int li_store_sigd;
    int li_store_siavl;
    int li_store_ssi;
    int li_store_sdi;
    int li_store_lp_vfb;
    int li_store_lp_stvfb;
    int li_store_lp_tox;
    int li_store_lp_epsrox;
    int li_store_lp_neff;
    int li_store_lp_vnsub;
    int li_store_lp_nslp;
    int li_store_lp_dnsub;
    int li_store_lp_dphib;
    int li_store_lp_np;
    int li_store_lp_ct;
    int li_store_lp_toxov;
    int li_store_lp_toxovd;
    int li_store_lp_nov;
    int li_store_lp_novd;
    int li_store_lp_cf;
    int li_store_lp_cfb;
    int li_store_lp_betn;
    int li_store_lp_stbet;
    int li_store_lp_mue;
    int li_store_lp_stmue;
    int li_store_lp_themu;
    int li_store_lp_stthemu;
    int li_store_lp_cs;
    int li_store_lp_stcs;
    int li_store_lp_xcor;
    int li_store_lp_stxcor;
    int li_store_lp_feta;
    int li_store_lp_rs;
    int li_store_lp_strs;
    int li_store_lp_rsb;
    int li_store_lp_rsg;
    int li_store_lp_thesat;
    int li_store_lp_stthesat;
    int li_store_lp_thesatb;
    int li_store_lp_thesatg;
    int li_store_lp_ax;
    int li_store_lp_alp;
    int li_store_lp_alp1;
    int li_store_lp_alp2;
    int li_store_lp_vp;
    int li_store_lp_a1;
    int li_store_lp_a2;
    int li_store_lp_sta2;
    int li_store_lp_a3;
    int li_store_lp_a4;
    int li_store_lp_gco;
    int li_store_lp_iginv;
    int li_store_lp_igov;
    int li_store_lp_igovd;
    int li_store_lp_stig;
    int li_store_lp_gc2;
    int li_store_lp_gc3;
    int li_store_lp_chib;
    int li_store_lp_agidl;
    int li_store_lp_agidld;
    int li_store_lp_bgidl;
    int li_store_lp_bgidld;
    int li_store_lp_stbgidl;
    int li_store_lp_stbgidld;
    int li_store_lp_cgidl;
    int li_store_lp_cgidld;
    int li_store_lp_cox;
    int li_store_lp_cgov;
    int li_store_lp_cgovd;
    int li_store_lp_cgbov;
    int li_store_lp_cfr;
    int li_store_lp_cfrd;
    int li_store_lp_fnt;
    int li_store_lp_fntexc;
    int li_store_lp_nfa;
    int li_store_lp_nfb;
    int li_store_lp_nfc;
    int li_store_lp_ef;
    int li_store_lp_rg;
    int li_store_lp_rbulk;
    int li_store_lp_rwell;
    int li_store_lp_rjuns;
    int li_store_lp_rjund;
    int li_store_tk;
    int li_store_cjosbot;
    int li_store_cjossti;
    int li_store_cjosgat;
    int li_store_vbisbot;
    int li_store_vbissti;
    int li_store_vbisgat;
    int li_store_idsatsbot;
    int li_store_idsatssti;
    int li_store_idsatsgat;
    int li_store_cjosbotd;
    int li_store_cjosstid;
    int li_store_cjosgatd;
    int li_store_vbisbotd;
    int li_store_vbisstid;
    int li_store_vbisgatd;
    int li_store_idsatsbotd;
    int li_store_idsatsstid;
    int li_store_idsatsgatd;
   // end store LIDs for output vars
     // bools for collapsing nodes
     bool collapseNode_GP;
     bool collapseNode_BP;
     bool collapseNode_BI;
     bool collapseNode_BS;
     bool collapseNode_BD;
 // Arrays to hold probes
 std::vector < double > probeVars;
 std::vector < std::vector < double > > d_probeVars;
 // Arrays to hold contributions
 // dynamic contributions are differentiated w.r.t time
 std::vector < double > staticContributions;
 std::vector < std::vector < double > > d_staticContributions;
 std::vector < double > dynamicContributions;
 std::vector < std::vector < double > > d_dynamicContributions;
//vectors to hold noise information for communication between methods
std::vector<double> noiseContribsPower;
std::vector<double> noiseContribsExponent;


    // this is what we'll use when any model uses $temperature.  We'll
    // set it in updateTemperature, and initialize it to whatever
    // is in devOptions when the instance is constructed.
    double admsTemperature;

    // vt at $temperature;
    double adms_vt_nom;


    // This one is for the annoying bogus "XyceADMSInstTemp" parameter
    // that we need so we can set it from the device manager when there's no
    // "TEMP" parameter to use
    double admsInstTemp;


    JacobianStamp jacStamp;
    IdVector nodeMap;
    PairMap pairToJacStampMap;

    // These instance-owned vectors are for storage of lead current data
    std::vector<double> leadCurrentF;
    std::vector<double> leadCurrentQ;


    };


//-----------------------------------------------------------------------------
// Class         : Model

// Purpose       :
// Special Notes :
// Creator       :
// Creation Date :
//-----------------------------------------------------------------------------
class Model : public DeviceModel
{
    typedef std::vector<Instance *> InstanceVector;

    friend class ParametricData<Model>;
    friend class Instance;
#ifdef Xyce_ADMS_SENSITIVITIES
    friend class InstanceSensitivity;
    friend class ModelSensitivity;
#endif // Xyce_ADMS_SENSITIVITIES
    friend struct Traits;

  public:
    Model(
      const Configuration &       configuration,
      const ModelBlock &          model_block,
      const FactoryBlock &        factory_block);

    ~Model();

private:
    Model(const Model &);
    Model &operator=(const Model &);

public:
    virtual void forEachInstance(DeviceInstanceOp &op) const /* override */;
    virtual std::ostream &printOutInstances(std::ostream &os) const;
    bool processParams();
    bool processInstanceParams();

  private:

  public:
    void addInstance(Instance *instance)
    {
      instanceContainer.push_back(instance);
    }

    void setupBaseInstanceContainer()
    {
      std::vector<Instance*>::iterator iter = instanceContainer.begin();
      std::vector<Instance*>::iterator end   = instanceContainer.end();
      for ( ; iter!=end; ++iter)
      {
      Xyce::Device::DeviceModel::baseInstanceContainer.push_back( static_cast<Xyce::Device::DeviceInstance *>(*iter) );
    }
  }

  private:
    std::vector<Instance*> instanceContainer;

  private:

    // This one is for the annoying bogus "XyceADMSInstTemp" parameter
    // that we need so we can set it from the device manager when there's no
    // "TEMP" model parameter to use
    double admsModTemp;
// Begin verilog Model Variables
//   Model Parameters
    double LEVEL;
    double TYPE;
    double TR;
    double SWIGATE;
    double SWIMPACT;
    double SWGIDL;
    double SWJUNCAP;
    double SWJUNASYM;
    double QMC;
    double LVARO;
    double LVARL;
    double LVARW;
    double LAP;
    double WVARO;
    double WVARL;
    double WVARW;
    double WOT;
    double DLQ;
    double DWQ;
    double VFBO;
    double VFBL;
    double VFBW;
    double VFBLW;
    double STVFBO;
    double STVFBL;
    double STVFBW;
    double STVFBLW;
    double TOXO;
    double EPSROXO;
    double NSUBO;
    double NSUBW;
    double WSEG;
    double NPCK;
    double NPCKW;
    double WSEGP;
    double LPCK;
    double LPCKW;
    double FOL1;
    double FOL2;
    double VNSUBO;
    double NSLPO;
    double DNSUBO;
    double DPHIBO;
    double DPHIBL;
    double DPHIBLEXP;
    double DPHIBW;
    double DPHIBLW;
    double NPO;
    double NPL;
    double CTO;
    double CTL;
    double CTLEXP;
    double CTW;
    double CTLW;
    double TOXOVO;
    double TOXOVDO;
    double LOV;
    double LOVD;
    double NOVO;
    double NOVDO;
    double CFL;
    double CFLEXP;
    double CFW;
    double CFBO;
    double UO;
    double FBET1;
    double FBET1W;
    double LP1;
    double LP1W;
    double FBET2;
    double LP2;
    double BETW1;
    double BETW2;
    double WBET;
    double STBETO;
    double STBETL;
    double STBETW;
    double STBETLW;
    double MUEO;
    double MUEW;
    double STMUEO;
    double THEMUO;
    double STTHEMUO;
    double CSO;
    double CSL;
    double CSLEXP;
    double CSW;
    double CSLW;
    double STCSO;
    double XCORO;
    double XCORL;
    double XCORW;
    double XCORLW;
    double STXCORO;
    double FETAO;
    double RSW1;
    double RSW2;
    double STRSO;
    double RSBO;
    double RSGO;
    double THESATO;
    double THESATL;
    double THESATLEXP;
    double THESATW;
    double THESATLW;
    double STTHESATO;
    double STTHESATL;
    double STTHESATW;
    double STTHESATLW;
    double THESATBO;
    double THESATGO;
    double AXO;
    double AXL;
    double ALPL;
    double ALPLEXP;
    double ALPW;
    double ALP1L1;
    double ALP1LEXP;
    double ALP1L2;
    double ALP1W;
    double ALP2L1;
    double ALP2LEXP;
    double ALP2L2;
    double ALP2W;
    double VPO;
    double A1O;
    double A1L;
    double A1W;
    double A2O;
    double STA2O;
    double A3O;
    double A3L;
    double A3W;
    double A4O;
    double A4L;
    double A4W;
    double GCOO;
    double IGINVLW;
    double IGOVW;
    double IGOVDW;
    double STIGO;
    double GC2O;
    double GC3O;
    double CHIBO;
    double AGIDLW;
    double AGIDLDW;
    double BGIDLO;
    double BGIDLDO;
    double STBGIDLO;
    double STBGIDLDO;
    double CGIDLO;
    double CGIDLDO;
    double CGBOVL;
    double CFRW;
    double CFRDW;
    double FNTO;
    double FNTEXCL;
    double NFALW;
    double NFBLW;
    double NFCLW;
    double EFO;
    double LINTNOI;
    double ALPNOI;
    double DTA;
    double KVTHOWEO;
    double KVTHOWEL;
    double KVTHOWEW;
    double KVTHOWELW;
    double KUOWEO;
    double KUOWEL;
    double KUOWEW;
    double KUOWELW;
    double LMIN;
    double LMAX;
    double WMIN;
    double WMAX;
    double RGO;
    double RBULKO;
    double RWELLO;
    double RJUNSO;
    double RJUNDO;
    double RINT;
    double RVPOLY;
    double RSHG;
    double DLSIL;
    double SAREF;
    double SBREF;
    double WLOD;
    double KUO;
    double KVSAT;
    double TKUO;
    double LKUO;
    double WKUO;
    double PKUO;
    double LLODKUO;
    double WLODKUO;
    double KVTHO;
    double LKVTHO;
    double WKVTHO;
    double PKVTHO;
    double LLODVTH;
    double WLODVTH;
    double STETAO;
    double LODETAO;
    double SCREF;
    double WEB;
    double WEC;
    double IMAX;
    double TRJ;
    double CJORBOT;
    double CJORSTI;
    double CJORGAT;
    double VBIRBOT;
    double VBIRSTI;
    double VBIRGAT;
    double PBOT;
    double PSTI;
    double PGAT;
    double PHIGBOT;
    double PHIGSTI;
    double PHIGGAT;
    double IDSATRBOT;
    double IDSATRSTI;
    double IDSATRGAT;
    double CSRHBOT;
    double CSRHSTI;
    double CSRHGAT;
    double XJUNSTI;
    double XJUNGAT;
    double CTATBOT;
    double CTATSTI;
    double CTATGAT;
    double MEFFTATBOT;
    double MEFFTATSTI;
    double MEFFTATGAT;
    double CBBTBOT;
    double CBBTSTI;
    double CBBTGAT;
    double FBBTRBOT;
    double FBBTRSTI;
    double FBBTRGAT;
    double STFBBTBOT;
    double STFBBTSTI;
    double STFBBTGAT;
    double VBRBOT;
    double VBRSTI;
    double VBRGAT;
    double PBRBOT;
    double PBRSTI;
    double PBRGAT;
    double CJORBOTD;
    double CJORSTID;
    double CJORGATD;
    double VBIRBOTD;
    double VBIRSTID;
    double VBIRGATD;
    double PBOTD;
    double PSTID;
    double PGATD;
    double PHIGBOTD;
    double PHIGSTID;
    double PHIGGATD;
    double IDSATRBOTD;
    double IDSATRSTID;
    double IDSATRGATD;
    double CSRHBOTD;
    double CSRHSTID;
    double CSRHGATD;
    double XJUNSTID;
    double XJUNGATD;
    double CTATBOTD;
    double CTATSTID;
    double CTATGATD;
    double MEFFTATBOTD;
    double MEFFTATSTID;
    double MEFFTATGATD;
    double CBBTBOTD;
    double CBBTSTID;
    double CBBTGATD;
    double FBBTRBOTD;
    double FBBTRSTID;
    double FBBTRGATD;
    double STFBBTBOTD;
    double STFBBTSTID;
    double STFBBTGATD;
    double VBRBOTD;
    double VBRSTID;
    double VBRGATD;
    double PBRBOTD;
    double PBRSTID;
    double PBRGATD;
    double SWJUNEXP;
    double VJUNREF;
    double FJUNQ;
    double VJUNREFD;
    double FJUNQD;
    //  Variables of global_model scope
    double NSUBO_i;
    double WSEG_i;
    double NPCK_i;
    double WSEGP_i;
    double LPCK_i;
    double LOV_i;
    double LOVD_i;
    double LP1_i;
    double LP2_i;
    double WBET_i;
    double AXL_i;
    double ALP1L2_i;
    double ALP2L2_i;
    double RINT_i;
    double RVPOLY_i;
    double SAREF_i;
    double SBREF_i;
    double KVSAT_i;
    double LLODKUO_i;
    double WLODKUO_i;
    double LLODVTH_i;
    double WLODVTH_i;
    double LODETAO_i;
    double SCREF_i;
    double WEB_i;
    double WEC_i;
    double TOX_i;
    double EPSROX_i;
    double TOXOV_i;
    double TOXOVD_i;
    double TKD;
    double dT;
    double rT;
    double rTn;
    double EPSSI;
    double phit;
    double inv_phit;
    double Eg;
    double phibFac;
    double nt0;
    int CHNL_TYPE;
    double IMAX_i;
    double VBIRBOT_i;
    double VBIRSTI_i;
    double VBIRGAT_i;
    double PBOT_i;
    double PSTI_i;
    double PGAT_i;
    double CSRHBOT_i;
    double CSRHSTI_i;
    double CSRHGAT_i;
    double CTATBOT_i;
    double CTATSTI_i;
    double CTATGAT_i;
    double CBBTBOT_i;
    double CBBTSTI_i;
    double CBBTGAT_i;
    double VBRBOT_i;
    double VBRSTI_i;
    double VBRGAT_i;
    double PBRBOT_i;
    double PBRSTI_i;
    double PBRGAT_i;
    double SWJUNEXP_i;
    double VJUNREF_i;
    double FJUNQ_i;
    double phitr;
    double phitd;
    double phitdinv;
    double perfc;
    double berfc;
    double cerfc;
    double ftdbot;
    double ftdsti;
    double ftdgat;
    double idsatbot;
    double idsatsti;
    double idsatgat;
    double vbibot;
    double vbisti;
    double vbigat;
    double vbiinvbot;
    double vbiinvsti;
    double vbiinvgat;
    double one_minus_PBOT;
    double one_minus_PSTI;
    double one_minus_PGAT;
    double one_over_one_minus_PBOT;
    double one_over_one_minus_PSTI;
    double one_over_one_minus_PGAT;
    double cjobot;
    double cjosti;
    double cjogat;
    double qprefbot;
    double qprefsti;
    double qprefgat;
    double qpref2bot;
    double qpref2sti;
    double qpref2gat;
    double wdepnulrbot;
    double wdepnulrsti;
    double wdepnulrgat;
    double wdepnulrinvbot;
    double wdepnulrinvsti;
    double wdepnulrinvgat;
    double VBIRBOTinv;
    double VBIRSTIinv;
    double VBIRGATinv;
    double atatbot;
    double atatsti;
    double atatgat;
    double btatpartbot;
    double btatpartsti;
    double btatpartgat;
    double fbbtbot;
    double fbbtsti;
    double fbbtgat;
    double fstopbot;
    double fstopsti;
    double fstopgat;
    double VBRinvbot;
    double VBRinvsti;
    double VBRinvgat;
    double slopebot;
    double slopesti;
    double slopegat;
    double VBIRBOTD_i;
    double VBIRSTID_i;
    double VBIRGATD_i;
    double PBOTD_i;
    double PSTID_i;
    double PGATD_i;
    double CSRHBOTD_i;
    double CSRHSTID_i;
    double CSRHGATD_i;
    double CTATBOTD_i;
    double CTATSTID_i;
    double CTATGATD_i;
    double CBBTBOTD_i;
    double CBBTSTID_i;
    double CBBTGATD_i;
    double VBRBOTD_i;
    double VBRSTID_i;
    double VBRGATD_i;
    double PBRBOTD_i;
    double PBRSTID_i;
    double PBRGATD_i;
    double VJUNREFD_i;
    double FJUNQD_i;
    double ftdbot_d;
    double ftdsti_d;
    double ftdgat_d;
    double idsatbot_d;
    double idsatsti_d;
    double idsatgat_d;
    double vbibot_d;
    double vbisti_d;
    double vbigat_d;
    double vbiinvbot_d;
    double vbiinvsti_d;
    double vbiinvgat_d;
    double one_minus_PBOT_d;
    double one_minus_PSTI_d;
    double one_minus_PGAT_d;
    double one_over_one_minus_PBOT_d;
    double one_over_one_minus_PSTI_d;
    double one_over_one_minus_PGAT_d;
    double cjobot_d;
    double cjosti_d;
    double cjogat_d;
    double qprefbot_d;
    double qprefsti_d;
    double qprefgat_d;
    double qpref2bot_d;
    double qpref2sti_d;
    double qpref2gat_d;
    double wdepnulrbot_d;
    double wdepnulrsti_d;
    double wdepnulrgat_d;
    double wdepnulrinvbot_d;
    double wdepnulrinvsti_d;
    double wdepnulrinvgat_d;
    double VBIRBOTinv_d;
    double VBIRSTIinv_d;
    double VBIRGATinv_d;
    double atatbot_d;
    double atatsti_d;
    double atatgat_d;
    double btatpartbot_d;
    double btatpartsti_d;
    double btatpartgat_d;
    double fbbtbot_d;
    double fbbtsti_d;
    double fbbtgat_d;
    double fstopbot_d;
    double fstopsti_d;
    double fstopgat_d;
    double VBRinvbot_d;
    double VBRinvsti_d;
    double VBRinvgat_d;
    double slopebot_d;
    double slopesti_d;
    double slopegat_d;
    // end verilog model variables=====
};

void registerDevice(const DeviceCountMap& deviceMap = DeviceCountMap(),
                    const std::set<int>& levelSet = std::set<int>());

} // namespace ADMSPSP102VA
} // namespace Device
} // namespace Xyce
#endif //Xyce_N_DEV_ADMSPSP102VA_h
